Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Location
    Loughborough (UK)
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Change Form Action

    Hello,

    Ok, my knowledge is generally server-side, and even that is limited, so I need a little help with some JS if you can. Basically I want to change the action of the form if option 5 is selected on one of the drop-down menus. I have written the below code, but I think I may have over simplified it. The form tags include...

    id="formtags"

    Any help would be much appreciated.
    Thanks,
    Chris

    - - - - - - - - - -

    function ChangeFormAction()
    {
    var srcElem = window.event.srcElement;
    var action = formtags.action;
    action="DealerSalesReports.aspx"

    if(srcElem.value == 5)
    {
    action="DealerLeadsSummary.aspx"
    }
    }

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    "id" is not the same thing with "name".

    If you want to use:

    .
    .
    .
    var action = formtags.action
    .
    .

    than give a name to your element, like <tag name="formtags">. You can keep the "id", if you need it in another function. The "id" and the"name" can have same values.

    "id" is asociated with something like getElementById(id), which is a method to retrive an element straight by his "id", without mentioning the tree position in page.

    When using the "name" of the element, often you have to mention all the tree elements and their names.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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