Form events

Discussion in 'Perl' started by pavan196, Sep 29, 2006.

  1. pavan196

    pavan196 New Member

    Joined:
    Sep 29, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,
    I have a question about handling form events in CGI -perl.
    I have a main form which has a action event(ACTION1) which is triggered when a
    submit button(SUBMIT) is pressed. But then I have an additional button in the
    main form(ADD)which on click should open a new form(ACTION2) to which i need to
    pass values from the main form. Since a form can have only one action event, I defined a seperate form and stored the definition of ADD button in a perl variable which i referenced it the main form. But I find the ADD button still triggers the main form's action event eventhough it is defnition exists in a different form with action attribute ACTION2. I guess it is because it is in the scope of main form. It would be great if anyone can help me on how should i proceed?
    Thanks
    Pavan
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    You can use JavaScript to the change the action of the form at the onClick event of a button.

    Example:
    Code:
    document.forms[0].action = 'somepage.asp';
     document.forms[0].action = 'anotherpage.php';
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice