Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:12:04+00:00 2026-06-17T16:12:04+00:00

This Is my Html Form by which i m creating a form and dynamic

  • 0

This Is my Html Form by which i m creating a form and dynamic fields

<div style="margin:10px 0;color:#574F44;margin-left:160px;">
    <form name="frmsignup3" method="post" action="new_user2.php" style="margin-top:0px; line-height:60px;" enctype="multipart/form-data" onsubmit="return validateForm2()" >
        <input type="hidden" name="user_name" value="<?php echo $_POST['user_name']?>" />
        <input type="hidden" name="user_email" value="<?php echo $_POST['user_email']?>" />
        <input type="hidden" name="user_pass" value="<?php echo $_POST['user_pass']?>" />
        <input type="hidden" name="user_gen" value="<?php echo $_POST['user_gen']?>" />
        <input type="hidden" name="user_dob_m" value="<?php echo $_POST['user_dob_m']?>" />
        <input type="hidden" name="user_dob_d" value="<?php echo $_POST['user_dob_d']?>" />
        <input type="hidden" name="user_dob_y" value="<?php echo $_POST['user_dob_y']?>" />
        <input type="hidden" name="user_ili" value="<?php echo $_POST['user_ili']?>" />
        <input type="hidden" name="user_pc" value="<?php echo $_POST['user_pc']?>" />
        <input type="hidden" name="user_prof" value="<?php echo $_POST['user_prof']?>" />

        <label id="l" style="width:80px;">Specialities:</label>
        <input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user[]"/>
        <!---------Dyanmic Fields  for specialities---------->
        <div id="add_user" style="display: none;"><label id="l" style="width:80px;">&nbsp;</label><input id="l"  class="l"type="text" size="37" style="width:auto;" name="user[]" value="" /></div>
        <input type="button" id="add_user()" onclick="add_user('add_user')" value="Add More!" /><br>
        <br class="clear"/>
        <!---------Dyanmic Fields ---------->

        <label id="l" style="width:120px;">Employment History:</label>
        <br class="clear"/>
        <label id="l" style="width:80px;">Role:</label>
        <input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_role[]"/>
        <br class="clear"/>
        <label id="l" style="width:80px;">Company:</label>
        <input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_com[]"/>
        <br class="clear"/>
        <label id="l" style="width:80px;">From:</label>
        <input id="datepicker"  class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_from[]"/>
        <br class="clear"/>
        <label id="l" style="width:80px;">To:</label>
        <input id="datepicker1" class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_to[]"/>
        <br class="clear"/>

        <!---------Dyanmic Fields for employment history---------->
        <div id="add_user1" style="display: none;" >
        <label id="l" style="width:80px;">Role:</label><input id="l" type="text" size="37" style="width:auto;" name="user_role[]" value="" /><br class="clear"/>
        <label id="l" style="width:80px;">Company:</label><input id="l" type="text" size="37" style="width:auto;" name="user_com[]" value="" /><br class="clear"/>
        <label id="l" style="width:80px;">From:</label><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[]" /><br class="clear"/>
        <label id="l" style="width:80px;">To:</label><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[]"/><br class="clear"/></div>
        <input type="button" id="add_user1()" onclick="add_user1('add_user1')" name="btn" value="Add More!" /><br>
        <br class="clear"/>
        <!---------Dyanmic Fields ---------->

        <label id="l" style="width:80px;">Qualification:</label>
        <br class="clear"/>
        <label id="l" style="width:80px;">Degree:</label>
        <input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_quli[]"/>
        <br class="clear"/>
        <label id="l" style="width:80px;">Institute:</label>
        <input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_ins[]"/>
        <br class="clear"/>
        <label id="l" style="width:80px;">From:</label>
        <input id="datepicker2" class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_qfrom[]"/>
        <br class="clear"/>
        <label id="l" style="width:80px;">To:</label>
        <input id="datepicker3" class="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_qto[]"/>
        <br class="clear"/>

        <!---------Dyanmic Fields for education---------->
        <div id="add_user2" style="display: none;">
        <label id="l" style="width:80px;">Degree:</label><input id="l" type="text" size="37" style="width:auto;" name="user_quli[]" value="" /><br class="clear"/>
        <label id="l" style="width:80px;">Institute:</label><input id="l" type="text" size="37" style="width:auto;" name="user_ins[]" value="" /><br class="clear"/>
        <label id="l" style="width:80px;">From:</label><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[]" /><br class="clear"/>
        <label id="l" style="width:80px;">To:</label><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[]"/><br class="clear"/></div>
        <input type="button" id="add_user2()" onclick="add_user2('add_user2')" value="Add More!" /><br>
        <br class="clear"/> 
        <!---------Dyanmic Fields ---------->
        <!--Error Div-->
        <div  id="errorcv" style="display: none"> 

        </div>  
        <!--Error Div-->               
        <label id="l" style="width:80px;">Upload CV:</label>
        <input id="l" type="file" size="37"  style="width:auto;" name="user_cv" onblur="return checkcv('user_cv')" accept="application/msword"/>
        <br class="clear"/>
        <!--Error Div-->
        <div  id="errorimg" style="display: none"> 
        </div>  
        <!--Error Div-->
        <label id="l" style="width:80px;">Upload Image:</label>
        <input id="l" type="file" size="37"  style="width:auto;" name="user_img" onblur="return checkPhoto('user_img')" accept="image/*"/>
        <br class="clear"/>
        <label id="l" style="width:80px; margin-left:90px; margin-right:15px;"><a href="" >Skip this step</a></label>
        <input type="image" src="<?php echo DIR_PATH?>images/btn_next.gif" alt=""/>
        <br class="clear"/>
    </form>

This is my javascript by which I am generating dynamic fields. Now I want to validate that dynamicaly generated fields

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<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<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<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();
}

I want to validate dynamic created text fields.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:12:05+00:00Added an answer on June 17, 2026 at 4:12 pm

    I assume you have different type fields. So when you add new fields add same class to every different type. Then you can easily put up validator function before post to chekc all types like this:

    function your_validator() {
    var passed = true;
    $('.Specialities').each(function(){
     var current = $.trim($(this).val());
     if (your_false_condition) passed = false;//chekc specialiti value if its not ok
    });
    
    if (passed == false) {
    alert('error');
    return false;
    }
    return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this html form which has options: <tr> <td width=30 height=35><font size=3>*List:</td> <td
I have a webpage with a form, which looks kinda like this: @using (Html.BeginForm(MyAction,
I have a simple html form. This form has a specific width and margin
Okay so say I have a form element like this: HTML: <div class=form-item> <label>Current
I am creating a form which has many dynamic dropdown.. values selected in first
I am creating a form which updates two related models, for this example a
The case: I have a form class which handles HTML forms, cleans up fields
I'm creating an HTML form, which takes some of its options from a database
How can I the HTML string <br> from this HTML FORM pass to the
Given this HTML: <form id=formx> <input type=text value= /> </form> And this JavaScript: $(function()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.