Loading ...
Sorry, an error occurred while loading the content.

determining which submit button pushed

Expand Messages
  • simian187
    Hello, I have a form with multiple submit buttons, using AddInput(array( TYPE = submit , ID = button_name )) I am trying to determine which button is
    Message 1 of 6 , Apr 8 12:41 PM
    View Source
    • 0 Attachment
      Hello,

      I have a form with multiple submit buttons,
      using AddInput(array(
      "TYPE" => "submit",
      "ID" => "button_name"
      ))

      I am trying to determine which button is pushed in my form script, using
      WasSubmitted( 'button_name' ), WasSubmitted( 'otherbutton_name' ), etc.

      WasSubmitted always returns an empty string, even when I call it with
      an empty string as parameter.

      What am I doing wrong?

      Regards,
      Marc Mauger
    • Manuel Lemos
      Hello, ... You need to define the NAME attribute or else the browser does not pass the information about which input was used. -- Regards, Manuel Lemos PHP
      Message 2 of 6 , Apr 8 12:57 PM
      View Source
      • 0 Attachment
        Hello,

        on 04/08/2005 04:41 PM simian187 said the following:
        > I have a form with multiple submit buttons,
        > using AddInput(array(
        > "TYPE" => "submit",
        > "ID" => "button_name"
        > ))
        >
        > I am trying to determine which button is pushed in my form script, using
        > WasSubmitted( 'button_name' ), WasSubmitted( 'otherbutton_name' ), etc.
        >
        > WasSubmitted always returns an empty string, even when I call it with
        > an empty string as parameter.
        >
        > What am I doing wrong?

        You need to define the NAME attribute or else the browser does not pass
        the information about which input was used.

        --

        Regards,
        Manuel Lemos

        PHP Classes - Free ready to use OOP components written in PHP
        http://www.phpclasses.org/

        PHP Reviews - Reviews of PHP books and other products
        http://www.phpclasses.org/reviews/

        Metastorage - Data object relational mapping layer generator
        http://www.meta-language.net/metastorage.html
      • counter intelligence
        Thanks that worked
        Message 3 of 6 , Apr 8 1:10 PM
        View Source
        • 0 Attachment
          Thanks that worked

          >From: Manuel Lemos <mlemos@...>
          >Reply-To: forms-dev@yahoogroups.com
          >To: forms-dev@yahoogroups.com
          >Subject: Re: [forms-dev] determining which submit button pushed
          >Date: Fri, 08 Apr 2005 16:57:16 -0300
          >
          >Hello,
          >
          >on 04/08/2005 04:41 PM simian187 said the following:
          > > I have a form with multiple submit buttons,
          > > using AddInput(array(
          > > "TYPE" => "submit",
          > > "ID" => "button_name"
          > > ))
          > >
          > > I am trying to determine which button is pushed in my form script, using
          > > WasSubmitted( 'button_name' ), WasSubmitted( 'otherbutton_name' ), etc.
          > >
          > > WasSubmitted always returns an empty string, even when I call it with
          > > an empty string as parameter.
          > >
          > > What am I doing wrong?
          >
          >You need to define the NAME attribute or else the browser does not pass
          >the information about which input was used.
          >
          >--
          >
          >Regards,
          >Manuel Lemos
          >
          >PHP Classes - Free ready to use OOP components written in PHP
          >http://www.phpclasses.org/
          >
          >PHP Reviews - Reviews of PHP books and other products
          >http://www.phpclasses.org/reviews/
          >
          >Metastorage - Data object relational mapping layer generator
          >http://www.meta-language.net/metastorage.html
        • operationsengineer1@yahoo.com
          manuel, first, thanks for all you help. when i finally get this all worked out, i ll post some sample code on the net so that others can learn what you ve
          Message 4 of 6 , Apr 11 10:31 AM
          View Source
          • 0 Attachment
            manuel,

            first, thanks for all you help. when i finally get
            this all worked out, i'll post some sample code on the
            net so that others can learn what you've been so kind
            to teach me about your forms class and its interaction
            with css.

            second, i have another issue.

            please see...

            http://www.dbhub.net/enter_contract.php

            i have a standard css label definition that looks like
            this...

            #content_form label
            {
            clear: both;
            float: left;
            display: inline;
            width: 12em;
            margin: 0em 0em 0em 0em;
            border: 0em 0em 0em 0em;
            }

            the problem i have is that i want the width to be 10
            em on the page i linked above so that the date fits.
            the reason i need 12 em on the other pages is due to
            the length of the label.

            i tried adding "labelCLASS"=>"contract", to

            $form->AddInput(array(
            "TYPE"=>"text",
            "NAME"=>"contract_number",
            "ID"=>"contract_number",
            "LABEL"=>"Contract Number",
            "CLASS"=>"input",
            "SIZE"=>9,
            "MAXLENGTH"=>9,
            "ValidateAsNotEmpty"=>1,
            "ValidateAsNotEmptyErrorMessage"=>"you must enter a
            customer",
            "LABEL"=>"Contract Number",
            "labelCLASS"=>"contract",
            "TABINDEX"=>1,
            ));

            and then adding

            .contract
            {
            clear: both;
            float: left;
            display: inline;
            width: 10em;
            margin: 0em 0em 0em 0em;
            border: 0em 0em 0em 0em;
            }

            to my css page.

            unfortunately, the css goes unread and defaults to my
            standard label callout and ignores the above class
            definition.

            do you know what i'm doing wrong?

            i also tried...

            #content_form label .contract
            {
            clear: both;
            float: left;
            display: inline;
            width: 12em;
            margin: 0em 0em 0em 0em;
            border: 0em 0em 0em 0em;
            }

            and

            #content_form .contract
            {
            clear: both;
            float: left;
            display: inline;
            width: 12em;
            margin: 0em 0em 0em 0em;
            border: 0em 0em 0em 0em;
            }

            to no avail.

            once this is resolved, the next issue i have is that
            the year text box bottom doesn't line up with the
            other date elements - it is about 0.2em higher.

            if you know how i can adjust that, do tell.
            otherwise, i will get the current problem fixed and
            then post and example of the next problem.

            tia...



            __________________________________
            Do you Yahoo!?
            Yahoo! Small Business - Try our new resources site!
            http://smallbusiness.yahoo.com/resources/
          • Manuel Lemos
            Hello, ... It s LabelCLASS, not labelCLASS. ... That is more an HTML/CSS issue that really does not have to do with the class. -- Regards, Manuel Lemos PHP
            Message 5 of 6 , Apr 11 8:15 PM
            View Source
            • 0 Attachment
              Hello,

              on 04/11/2005 02:31 PM operationsengineer1@... said the following:
              > i tried adding "labelCLASS"=>"contract", to

              It's LabelCLASS, not labelCLASS.

              > once this is resolved, the next issue i have is that
              > the year text box bottom doesn't line up with the
              > other date elements - it is about 0.2em higher.
              >
              > if you know how i can adjust that, do tell.
              > otherwise, i will get the current problem fixed and
              > then post and example of the next problem.

              That is more an HTML/CSS issue that really does not have to do with the
              class.



              --

              Regards,
              Manuel Lemos

              PHP Classes - Free ready to use OOP components written in PHP
              http://www.phpclasses.org/

              PHP Reviews - Reviews of PHP books and other products
              http://www.phpclasses.org/reviews/

              Metastorage - Data object relational mapping layer generator
              http://www.meta-language.net/metastorage.html
            • operationsengineer1@yahoo.com
              ... yes. i m going to write that 100 times on a chalkboard as soon as i find a chalkboard! changing to LabelCLASS allowed the class css to be picked up by
              Message 6 of 6 , Apr 12 8:53 AM
              View Source
              • 0 Attachment
                > It's LabelCLASS, not labelCLASS.

                yes. i'm going to write that 100 times on a
                chalkboard as soon as i find a chalkboard!

                changing to "LabelCLASS" allowed the class css to be
                picked up by the text form label, but the date form
                label still doesn't pick it up. both browsers act the
                same way, though, so if i can't find a solution i can
                probably hack it together.

                >
                > > once this is resolved, the next issue i have is
                > that
                > > the year text box bottom doesn't line up with the
                > > other date elements - it is about 0.2em higher.
                > >
                > > if you know how i can adjust that, do tell.
                > > otherwise, i will get the current problem fixed
                > and
                > > then post and example of the next problem.
                >
                > That is more an HTML/CSS issue that really does not
                > have to do with the
                > class.

                this is true, however, folks who use css in
                combination with your forms (as more and more will no
                doubt do in the future) would obviously like to have
                the elements with correct vertical alignment. i will
                play around and see what i can do to get this to work.

                i'll post a solution should i arrive at one.




                __________________________________
                Do you Yahoo!?
                Yahoo! Mail - You care about security. So do we.
                http://promotions.yahoo.com/new_mail
              Your message has been successfully submitted and would be delivered to recipients shortly.