SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking calling dynamic form name

    hi guys, please take a look at this
    Code:
    formedit.field.value
    with this piece of code, i can access a value of a field inside a form. problem is, when i loop, i do this in naming my forms

    formedit_1
    formedit_2
    etc..

    on my link, i do this

    <a href="jsscript(id)">

    but i cant access the proper value. what i would like is that if i pass id=2, then the value from formedit-2 will be taken, if i pass id=1, then the value from formedit_1 will be taken. but i cant make it.. i tried this

    var test = 'formedit_' + id;
    alert(test.field.value);

    but it doesnt work, i think its in this "var test" is whats wrong, sorry, 0 JS skills, hehehe please help..
    If you won't dress like the
    Victoria Secret girls,
    don't expect us to act like soap opera guys.

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    San Francisco, CA
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try document.forms[test].field.value

  3. #3
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Quote Originally Posted by randomcode View Post
    try document.forms[test].field.value
    yay! the joy of knowing the basics! thanks a lot!

    i suppose they can delete this stupid thread before more would know i ask this lowly kinds of questions! hehehe

    Thanks again!
    If you won't dress like the
    Victoria Secret girls,
    don't expect us to act like soap opera guys.

  4. #4
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    no nothing
    Last edited by lance_vincent; Aug 8, 2007 at 02:07.
    If you won't dress like the
    Victoria Secret girls,
    don't expect us to act like soap opera guys.


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
  •