GetFormvalue not working in OnBeginWebRequest

Hi All,

I am trying to access input (type = hidden) from OnBeginWebRequest but i am unable to get any value. Tried to use Javascript to get the same value and it is working.

I am not sure what I am missing.

GetFormValue("__TOKEN") --> Using  HTTPRequestHandler GetFormValue

"alert('2-->'+document.getElementById('__TOKEN').value)" --> Using RunJavaScript

Below is the actual HTML element :

<span id="HubTheme_wt151_block_wt34_wtexpInput"><input type="hidden" name="__TOKEN" id="__TOKEN" value="d617583f-5aaa-49e8-b6f3-4648abdd618b"></span>

Thank you in advance.

Hi Lakshmi,

As OnBeginWebRequest will execute before the execution of Preparation and Screen Actions, your element will not be rendered yet on the page.
That's why you are not able to use GetFormValue inside the OnBeginWebRequest.

Palak Patel