0

On my master page I have:

<form id="ReportForm" action="HelpAsk.aspx" method="post">
    <input type="hidden" id="HiddenReport" type="text" />
</form>

This is outside any server tags, just before the tag.

Jquery submits this form when a button on the page is clicked somewhere:

function SendReport() {
    $("#HiddenReport").val("<html>" + $("html").html() + "</html>");
    $('#ReportForm').submit();    
}

But whatever I try, I can't get my receiving page to read that data:

NameValueCollection nvc = Request.Form;
if (!string.IsNullOrEmpty(nvc["HiddenReport"]))
{
    Response.Write("LOL:" + Request.Form["HiddenReport"]);
}

2 Answers 2

3

You need to give the input element a name attribute to have it posted with the form submit, e.g.

<input type="hidden" id="HiddenReport" name="HiddenReport" />

Also you have two type attributes, remove one of these.

Sign up to request clarification or add additional context in comments.

1 Comment

Doh! Thanks, it's early in the morning!
1

you need to add name attribute

<input type="hidden" id="HiddenReport" name="HidenReport" type="text" />

name use as key in posted form

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.