Friday, August 10, 2012

Attach/add post parameters to form


Add/replace input tag(s) within the form:

function fn_copyFormInputs(sourceFormName, targetFormName, inputNames) {
    for(var i=0; i<inputNames.length; i++){
      $('#' + targetFormName + ' #' + inputNames[i]).remove();
      var value = $('#' + sourceFormName + ' #' + inputNames[i]).val();
      $('<input />').attr('type', 'hidden').attr('name', inputNames[i]).attr('id', inputNames[i]).attr('value', value).appendTo('#' + targetFormName);
    }}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.