Closed Thread
Results 1 to 5 of 5

Thread: How to Create Dynamic Fields

  1. #1
    qasimbilal is offline Newbie
    Join Date
    Dec 2009
    Location
    Karachi, Pakistan
    Posts
    9
    Rep Power
    0

    How to Create Dynamic Fields

    Hi
    i want to create dynamic fields like (text fields, checkboxes etc) when user click on add more fields link.
    I am try but cannot find solution.
    please guide

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: How to Create Dynamic Fields

    Are you familiar with adding elements to the DOM using JavaScript?
    JavaScript Examples
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    qasimbilal is offline Newbie
    Join Date
    Dec 2009
    Location
    Karachi, Pakistan
    Posts
    9
    Rep Power
    0

    Re: How to Create Dynamic Fields

    Yes i am familiar with DOM. I have found the solution
    document.createElement() has solved my problem.
    thanks

  5. #4
    DarkLordoftheMonkeys's Avatar
    DarkLordoftheMonkeys is offline Programming Professional
    Join Date
    Oct 2009
    Location
    Massachussets
    Posts
    255
    Blog Entries
    56
    Rep Power
    11

    Re: How to Create Dynamic Fields

    It depends on what you're trying to do (You didn't explain real well). There are many ways of manipulating form elements (if that's what you're talking about), including the event handlers onsubmit, onreset, onfocus, onblur, onchange, and for text input fields onkeydown, onkeyup, and onkeypress. You can use the HTML DOM to manipulate things like the HTML code inside a couple tags. I used this in my web scripting class to make a text field next to a password input to give the strength of the password:

    Code:
    function pswdStrength(){
    	var Length = document.getElementById('password1').value.length;
    	var str = document.getElementById('strength');
    	if( Length < 5 ) str.innerHTML = "Password strength: weak";
    	else if( Length < 9 ) str.innerHTML = "Password strength: medium";
    	else str.innerHTML = "Password strength: strong";
    }
    For this I used an empty set of HTML tags:

    Code:
    <label for="password1">Password: </label>
    <input type="password" id="password1" name="password" width="15" maxlength="15" onkeypress="pswdStrength();" />
    <span id="strength"></span>
    There are many other neat things you can do with the HTML DOM.
    Life's too short to be cool. Be a nerd.

  6. #5
    qasimbilal is offline Newbie
    Join Date
    Dec 2009
    Location
    Karachi, Pakistan
    Posts
    9
    Rep Power
    0

    Re: How to Create Dynamic Fields

    Thanks a lot for guiding me and given some precious time of yours which is valuable more than money.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 07-23-2010, 03:41 AM
  2. Replies: 6
    Last Post: 04-19-2010, 12:55 PM
  3. Validating fields in VB ?
    By jashsayani in forum Visual Basic Programming
    Replies: 3
    Last Post: 04-13-2010, 04:35 PM
  4. Password Fields
    By TcM in forum Database & Database Programming
    Replies: 2
    Last Post: 12-29-2007, 06:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts