how to send data outside form while submitting -MVC ,HTML
In my view there is a form shown below
<% using (Html.BeginForm("SaveRecords", "Search", FormMethod.Post))
{ %>
<input type="submit" value="Save" class="button_62" title="Save" />
// some controls
<%} %>
My need is that there is another form in the same view.While clicking save button i need to get value of a particular text box that is outside the form submitting .I cant put that control in same form.And i can开发者_如何学JAVAt use ajax request to send data. Is there anyway i can append data outside of the form before submitting it?
I want to get value of that textbox(out sid the submitted form) in controller Saverecords ..
Here is an answer using javascript
using jQuery you could set a hidden field in the the form above containing the same value as the control that resides in the other form.
if you add an id to your form above then.
$("#myform").submit(function() {
$("#myhiddenId").val($("#fieldInOtherFormId").val());
});
精彩评论