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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Determining how a form was submitted

    Hi,

    I'm using the onchange attribute of the select tag to display info dynamically depending on the value of another drop down list.
    In order to do that, I submit the form when the value is changed, so that I can keep all the other values of the form.

    However, I'd like to process the data only if the user clicked the "Submit" button, not if the form was submitted by changing the value of one of the drop down lists.

    Any idea how I can know when the submit button has been clicked ?

  • #2
    New Coder
    Join Date
    Jun 2005
    Location
    London
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would need to see code to help you
    Never argue with an idiot.
    They just drag you down to their level...
    ...and beat you with experience.


    -----------------------------------------

    That which is static and repetitive is boring.
    That which is dynamic and random is confusing.
    In between lies art.

  • #3
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    you need to add a check to the value of the submit button (obviously the syntax depends on the language you're using)
    ie
    php
    PHP Code:
    if(isset($_POST['submit']){
    //process the form

    asp:
    Code:
    if request.form('submit')<> "" then
    'process form

  • #4
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    'submit' being the name of the button, I understand ?
    I was thinking of this solution, but wasn't sure if the button was considered "set" only if clicked.

  • #5
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    yes replace 'submit' with the name of your submit button


  •  

    Posting Permissions

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