Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic field validation in javascript or jquery
    primarykey
    data
    text
    <p>This Is my Html Form by which i m creating a form and dynamic fields</p> <pre><code>&lt;div style="margin:10px 0;color:#574F44;margin-left:160px;"&gt; &lt;form name="frmsignup3" method="post" action="new_user2.php" style="margin-top:0px; line-height:60px;" enctype="multipart/form-data" onsubmit="return validateForm2()" &gt; &lt;input type="hidden" name="user_name" value="&lt;?php echo $_POST['user_name']?&gt;" /&gt; &lt;input type="hidden" name="user_email" value="&lt;?php echo $_POST['user_email']?&gt;" /&gt; &lt;input type="hidden" name="user_pass" value="&lt;?php echo $_POST['user_pass']?&gt;" /&gt; &lt;input type="hidden" name="user_gen" value="&lt;?php echo $_POST['user_gen']?&gt;" /&gt; &lt;input type="hidden" name="user_dob_m" value="&lt;?php echo $_POST['user_dob_m']?&gt;" /&gt; &lt;input type="hidden" name="user_dob_d" value="&lt;?php echo $_POST['user_dob_d']?&gt;" /&gt; &lt;input type="hidden" name="user_dob_y" value="&lt;?php echo $_POST['user_dob_y']?&gt;" /&gt; &lt;input type="hidden" name="user_ili" value="&lt;?php echo $_POST['user_ili']?&gt;" /&gt; &lt;input type="hidden" name="user_pc" value="&lt;?php echo $_POST['user_pc']?&gt;" /&gt; &lt;input type="hidden" name="user_prof" value="&lt;?php echo $_POST['user_prof']?&gt;" /&gt; &lt;label id="l" style="width:80px;"&gt;Specialities:&lt;/label&gt; &lt;input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user[]"/&gt; &lt;!---------Dyanmic Fields for specialities----------&gt; &lt;div id="add_user" style="display: none;"&gt;&lt;label id="l" style="width:80px;"&gt;&amp;nbsp;&lt;/label&gt;&lt;input id="l" class="l"type="text" size="37" style="width:auto;" name="user[]" value="" /&gt;&lt;/div&gt; &lt;input type="button" id="add_user()" onclick="add_user('add_user')" value="Add More!" /&gt;&lt;br&gt; &lt;br class="clear"/&gt; &lt;!---------Dyanmic Fields ----------&gt; &lt;label id="l" style="width:120px;"&gt;Employment History:&lt;/label&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;Role:&lt;/label&gt; &lt;input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_role[]"/&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;Company:&lt;/label&gt; &lt;input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_com[]"/&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;From:&lt;/label&gt; &lt;input id="datepicker" class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_from[]"/&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;To:&lt;/label&gt; &lt;input id="datepicker1" class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_to[]"/&gt; &lt;br class="clear"/&gt; &lt;!---------Dyanmic Fields for employment history----------&gt; &lt;div id="add_user1" style="display: none;" &gt; &lt;label id="l" style="width:80px;"&gt;Role:&lt;/label&gt;&lt;input id="l" type="text" size="37" style="width:auto;" name="user_role[]" value="" /&gt;&lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;Company:&lt;/label&gt;&lt;input id="l" type="text" size="37" style="width:auto;" name="user_com[]" value="" /&gt;&lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;From:&lt;/label&gt;&lt;input class="datepicker" type="text" size="37" onblur="" value="" style=":Arial;font-weight:normal;font-size:11px;color:#7c7b77;outline: none;border: 1px solid #c7c7c7;margin:3px 5px;padding:8px 0;padding-left:5px;-moz-box-shadow: 0 0 5px #c7c7c7;-webkit-box-shadow: 0 0 5px #c7c7c7;box-shadow: 0 0 5px #c7c7c7;float:left;border-radius: 5px;" name="user_from[]" /&gt;&lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;To:&lt;/label&gt;&lt;input class="datepicker" type="text" size="37" onblur="" value="" style=":Arial;font-weight:normal;font-size:11px;color:#7c7b77;outline: none;border: 1px solid #c7c7c7;margin:3px 5px;padding:8px 0;padding-left:5px;-moz-box-shadow: 0 0 5px #c7c7c7;-webkit-box-shadow: 0 0 5px #c7c7c7;box-shadow: 0 0 5px #c7c7c7;float:left;border-radius: 5px;" name="user_to[]"/&gt;&lt;br class="clear"/&gt;&lt;/div&gt; &lt;input type="button" id="add_user1()" onclick="add_user1('add_user1')" name="btn" value="Add More!" /&gt;&lt;br&gt; &lt;br class="clear"/&gt; &lt;!---------Dyanmic Fields ----------&gt; &lt;label id="l" style="width:80px;"&gt;Qualification:&lt;/label&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;Degree:&lt;/label&gt; &lt;input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_quli[]"/&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;Institute:&lt;/label&gt; &lt;input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_ins[]"/&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;From:&lt;/label&gt; &lt;input id="datepicker2" class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_qfrom[]"/&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;To:&lt;/label&gt; &lt;input id="datepicker3" class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_qto[]"/&gt; &lt;br class="clear"/&gt; &lt;!---------Dyanmic Fields for education----------&gt; &lt;div id="add_user2" style="display: none;"&gt; &lt;label id="l" style="width:80px;"&gt;Degree:&lt;/label&gt;&lt;input id="l" type="text" size="37" style="width:auto;" name="user_quli[]" value="" /&gt;&lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;Institute:&lt;/label&gt;&lt;input id="l" type="text" size="37" style="width:auto;" name="user_ins[]" value="" /&gt;&lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;From:&lt;/label&gt;&lt;input class="datepicker" type="text" size="37" onblur="" value="" style=":Arial;font-weight:normal;font-size:11px;color:#7c7b77;outline: none;border: 1px solid #c7c7c7;margin:3px 5px;padding:8px 0;padding-left:5px;-moz-box-shadow: 0 0 5px #c7c7c7;-webkit-box-shadow: 0 0 5px #c7c7c7;box-shadow: 0 0 5px #c7c7c7;float:left;border-radius: 5px;" name="user_qfrom[]" /&gt;&lt;br class="clear"/&gt; &lt;label id="l" style="width:80px;"&gt;To:&lt;/label&gt;&lt;input class="datepicker" type="text" size="37" onblur="" value="" style=":Arial;font-weight:normal;font-size:11px;color:#7c7b77;outline: none;border: 1px solid #c7c7c7;margin:3px 5px;padding:8px 0;padding-left:5px;-moz-box-shadow: 0 0 5px #c7c7c7;-webkit-box-shadow: 0 0 5px #c7c7c7;box-shadow: 0 0 5px #c7c7c7;float:left;border-radius: 5px;" name="user_qto[]"/&gt;&lt;br class="clear"/&gt;&lt;/div&gt; &lt;input type="button" id="add_user2()" onclick="add_user2('add_user2')" value="Add More!" /&gt;&lt;br&gt; &lt;br class="clear"/&gt; &lt;!---------Dyanmic Fields ----------&gt; &lt;!--Error Div--&gt; &lt;div id="errorcv" style="display: none"&gt; &lt;/div&gt; &lt;!--Error Div--&gt; &lt;label id="l" style="width:80px;"&gt;Upload CV:&lt;/label&gt; &lt;input id="l" type="file" size="37" style="width:auto;" name="user_cv" onblur="return checkcv('user_cv')" accept="application/msword"/&gt; &lt;br class="clear"/&gt; &lt;!--Error Div--&gt; &lt;div id="errorimg" style="display: none"&gt; &lt;/div&gt; &lt;!--Error Div--&gt; &lt;label id="l" style="width:80px;"&gt;Upload Image:&lt;/label&gt; &lt;input id="l" type="file" size="37" style="width:auto;" name="user_img" onblur="return checkPhoto('user_img')" accept="image/*"/&gt; &lt;br class="clear"/&gt; &lt;label id="l" style="width:80px; margin-left:90px; margin-right:15px;"&gt;&lt;a href="" &gt;Skip this step&lt;/a&gt;&lt;/label&gt; &lt;input type="image" src="&lt;?php echo DIR_PATH?&gt;images/btn_next.gif" alt=""/&gt; &lt;br class="clear"/&gt; &lt;/form&gt; </code></pre> <p>This is my javascript by which I am generating dynamic fields. Now I want to validate that dynamicaly generated fields</p> <pre><code>var counter = 0; function add_user(FieldName) { counter++; var newFields = document.getElementById(FieldName).cloneNode(true); newFields.id = ''; newFields.style.display = 'block'; var newField = newFields.childNodes; for (var i=0;i&lt;newField.length;i++) { var theName = newField[i].name if (theName) newField[i].name = theName + counter; } var insertHere = document.getElementById(FieldName); insertHere.parentNode.insertBefore(newFields,insertHere); } var counter = 0; function add_user1(FieldName) { counter++; var newFields = document.getElementById(FieldName).cloneNode(true); newFields.id = ''; newFields.style.display = 'block'; var newField = newFields.childNodes; for (var i=0;i&lt;newField.length;i++) { var theName = newField[i].name if (theName) newField[i].name = theName + counter; } var insertHere = document.getElementById(FieldName); insertHere.parentNode.insertBefore(newFields,insertHere); $(newFields).find('.datepicker').datepicker(); } var counter = 0; function add_user2(FieldName) { counter++; var newFields = document.getElementById(FieldName).cloneNode(true); newFields.id = ''; newFields.style.display = 'block'; var newField = newFields.childNodes; for (var i=0;i&lt;newField.length;i++) { var theName = newField[i].name if (theName) newField[i].name = theName + counter; } var insertHere = document.getElementById(FieldName); insertHere.parentNode.insertBefore(newFields,insertHere); $(newFields).find('.datepicker').datepicker(); } </code></pre> <p>I want to validate dynamic created text fields.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload