no

Jquery copy form values into another form

Recently I have a requirement to have two form on a single page. Why? It's because I have a search form that query records from the da...

Recently I have a requirement to have two form on a single page.

Why? It's because I have a search form that query records from the database with the aid of ajax. Then another form to generate a report based from the filters specified in the first form.

So when the submit button from the search form is pressed, it populates the fields on the second form with values from the first form. And here's how I did it in jquery:

$(':input[name]', "#searchForm").each(function () {
  if ($(this).attr('name') != 'SubmitButton') {
  $('[name=' + $(this).attr('name') + ']', "#generateReportForm").val($(this).val());
  }
})   

Related

web 8198730602776550781

Post a Comment

item