PHP & Javascript insanity

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Karl Groves

    #1

    PHP & Javascript insanity

    So, I've been fighting with this for a day now and would love some help.

    I am working on:

    Because of the size of the form, users have been getting a bit trigger-
    happy on the submit button.

    I've found a method to disable the submit button, but now I have a problem
    with my server-side validation.

    The form submits to itself to do validation based on whether or not
    $_REQUEST['submit'] isset.

    The problem is that now that I have the javascript in place to disable the
    button, $_REQUEST['submit'] is never getting set.

    TIA for any guidance on what is causing this.

    --
    Karl Groves


  • Michael Winter

    #2
    Re: PHP & Javascript insanity

    On 12/04/2006 14:54, Karl Groves wrote:
    [color=blue]
    > I am working on:
    > http://www.webaccessstrategies.com/c...enewalform.php
    > Because of the size of the form, users have been getting a bit trigger-
    > happy on the submit button.[/color]

    I'm not surprised. It's enormous! The first thing I'd suggest is
    breaking it down into sections, and allow the user to move between them.
    With a form that large, it might also be beneficial to allow the user to
    save it in a partial state then log back in to resume at a later date.
    [color=blue]
    > I've found a method to disable the submit button, [...][/color]

    I suggest that you lose it again: it's not good for usability. Consider
    what happens if the user has problems submitting and hits the back
    button to try again. How do you propose they resubmit?

    [snip]
    [color=blue]
    > The problem is that now that I have the javascript in place to disable the
    > button, $_REQUEST['submit'] is never getting set.[/color]

    Disabled form controls are not successful; they don't become part of the
    form data set.

    Mike

    --
    Michael Winter
    Prefix subject with [News] before replying by e-mail.

    Comment

    • Juan José Gutiérrez de QuevedoPérez

      #3
      Re: PHP & Javascript insanity

      El Wed, 12 Apr 2006 08:54:03 -0500
      Karl escribió:
      [color=blue]
      > The form submits to itself to do validation based on whether or not
      > $_REQUEST['submit'] isset.[/color]

      well, you could just add a hidden field and check for it instead.

      <input type="hidden" id="issubmiting " value="1"/>

      and then in your code

      if(isset($_POST['issubmiting'])&&$_POST['issubmiting']=='1')
      {
      //process the form
      }

      --
      Juan José Gutiérrez de Quevedo
      Director Técnico (juanjo@iteisa. com)
      ITEISA (http://www.iteisa.com)
      942544036 - 637447953

      Comment

      • Karl Groves

        #4
        Re: PHP &amp; Javascript insanity

        Michael Winter <m.winter@bluey onder.co.uk> wrote in
        news:fV7%f.5207 7$wl.1164@text. news.blueyonder .co.uk:
        [color=blue]
        > On 12/04/2006 14:54, Karl Groves wrote:[/color]
        [color=blue][color=green]
        >> The problem is that now that I have the javascript in place to
        >> disable the button, $_REQUEST['submit'] is never getting set.[/color]
        >
        > Disabled form controls are not successful; they don't become part of
        > the form data set.[/color]

        Ah, OK. So by disabling it, no value is passed. Dur. I should have known
        better. Thanks for the response!


        --
        Karl Groves



        Accessibility Discussion List: http://smallerurl.com/?id=6p764du

        Comment

        • Areric

          #5
          Re: PHP &amp; Javascript insanity

          Wow, i strongly recommend you asses what questions on that form
          logically fit together and break it up into multiple pages. If i were
          filling that out im pretty sure id go crazy. Even if it takes just as
          long, having more susinct things can help usability.

          Comment

          • rlee0001

            #6
            Re: PHP &amp; Javascript insanity

            Also, if this form is a renewal form for existing clients, why are you
            having them re-enter all their information? Shouldn't you just show
            them the information you have on file and ask for a confirmation?

            I'd really hate to have to fill out this entire form every six months
            when the only piece of information that has changed was my
            symtoms/illness.

            Also, consider client-side validation via jscript to compliment the
            serverside validation.

            -Robert

            Comment

            • Karl Groves

              #7
              Re: PHP &amp; Javascript insanity

              "Areric" <josh.schramm@g mail.com> wrote in news:1144851661 .619216.39750
              @u72g2000cwu.go oglegroups.com:
              [color=blue]
              > Wow, i strongly recommend you asses what questions on that form
              > logically fit together and break it up into multiple pages. If i were
              > filling that out im pretty sure id go crazy. Even if it takes just as
              > long, having more susinct things can help usability.
              >[/color]

              I've already "strongly recommended it" to the client. They didn't want to
              hear it.



              --
              Karl Groves



              Accessibility Discussion List: http://smallerurl.com/?id=6p764du

              Comment

              • Karl Groves

                #8
                Re: PHP &amp; Javascript insanity

                "rlee0001" <robeddielee@ho tmail.com> wrote in news:1144852867 .175801.148370
                @i39g2000cwa.go oglegroups.com:
                [color=blue]
                > Also, if this form is a renewal form for existing clients, why are you
                > having them re-enter all their information? Shouldn't you just show
                > them the information you have on file and ask for a confirmation?
                >
                > I'd really hate to have to fill out this entire form every six months
                > when the only piece of information that has changed was my
                > symtoms/illness.
                >[/color]

                Client required it.
                There's only so many times you can say "I don't really think that's a good
                idea", before you just throw your hands up and do what they ask.



                --
                Karl Groves


                Comment

                • fletch

                  #9
                  Re: PHP &amp; Javascript insanity

                  Here's how I disable a button on submit

                  <input type="submit" onclick="Please Wait(this)" />

                  the javascript is

                  function PleaseWait(butt on)
                  {
                  button.value='P LEASE WAIT';
                  button.style.co lor='red';
                  button.onclick= function() {
                  alert('Please Wait');
                  return false;
                  }
                  return true;
                  }

                  We also do server side checking for duplicate form posts on all forms
                  received.

                  Comment

                  • Jerry Stuckle

                    #10
                    Re: PHP &amp; Javascript insanity

                    fletch wrote:[color=blue]
                    > Here's how I disable a button on submit
                    >
                    > <input type="submit" onclick="Please Wait(this)" />
                    >
                    > the javascript is
                    >
                    > function PleaseWait(butt on)
                    > {
                    > button.value='P LEASE WAIT';
                    > button.style.co lor='red';
                    > button.onclick= function() {
                    > alert('Please Wait');
                    > return false;
                    > }
                    > return true;
                    > }
                    >
                    > We also do server side checking for duplicate form posts on all forms
                    > received.
                    >[/color]

                    You can't unless you send the page back to the client. Javascript is
                    client-side, while PHP is server-side.

                    --
                    =============== ===
                    Remove the "x" from my email address
                    Jerry Stuckle
                    JDS Computer Training Corp.
                    jstucklex@attgl obal.net
                    =============== ===

                    Comment

                    • fletch

                      #11
                      Re: PHP &amp; Javascript insanity

                      Well, I do.

                      (client) form -> *submit* -> submit button disabled -> (server now)
                      form compared to previous forms -> form validated -> form saved to
                      session -> form processed or represented to user to fix (client again).
                      [color=blue]
                      > Javascript is client-side, while PHP is server-side.[/color]

                      yup.

                      Comment

                      • Richard Levasseur

                        #12
                        Re: PHP &amp; Javascript insanity

                        An easy method of accomplishing this would be to have a hidden field
                        with the submit value and leave the button unnamed.

                        Comment

                        Working...