views:

32

answers:

2

Hi, multiple content place holders..1 with a text entry box and a submit button.. the second content place holder has several options in.. when i perform the submit the options from the 2nd place holder aren't getting passed through. can you suggest a method on how i can perform this submission passing all values to my controller? the values outside the 1st place holder are getting set to null.

thanks

A: 

Only successful controls are submitted. Check the html 4 documentation:

http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2

To submit unchecked inputs put a hidden input with the same name before the checkbox:

http://stackoverflow.com/questions/476426/submit-an-html-form-with-empty-checkboxes

GJ
the problem is that the checkboxes are outside the form. so when submitting these are not picked up.
nologo
Copy the values before submitting: $('form').submit(function(event){ /*insert code to copy values from other form*/ return true; });
GJ
A: 

thanks, i resolve the problem with your help!

    $('#indexform').submit(function (ev) {
    $('#hiddenField').attr('value', $('input[name=CheckboxOption]:checked').val());
    return true;
});

    <fieldset>
        <%: Html.HiddenFor(searchCriteria => searchCriteria.Database, new { id = "hiddenField" })%>
    </fieldset>
nologo