SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simulating a click of submit button without actually clicking on it.

    Hi All,

    Is there any way, where I can simulate clicking on a submit button (or any other button) with out actually on it. For example, is there any property click associated with submit button, which i can set it on in the code...

    subButton.click=true;

    which will eventually trigger a click on submit button.

    Please help me.....

    Pls. see. I don't want to make use of document.forms[0].submit(); coz this is not I want.

    I'll be really grateful for any kind of help.

    Thank you,
    Programmer in trouble

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well the first question would be ..... when do you want this "fake" submit to fire (happen) ........ something has to trigger it

  3. #3
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could have a JS function attached to the onClick of the Submit Button which always returns false. That way you will not submit the form.

    Tryst

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there any way, where I can simulate clicking on a submit button (or any other button) with out actually on it

    I don't want to make use of document.forms[0].submit(); coz this is not I want.
    Ok, this is my 4th and final answer:

    In your script, if you use:

    document.forms[0].onsubmit();

    any function assigned to your onsubmit event handler will execute, but the form will not submit.

    If you describe why the submit() method is not what you want, then it would be easier to answer your question.


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
  •