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

Hidden Element Form Submission

Expand Messages
  • operationsengineer1@yahoo.com
    hi Manuel, in some of my scripts, i use $form- AddInput(array( TYPE = hidden , NAME = _submit_check , VALUE = 1, ValidateAsInteger = 1,
    Message 1 of 2 , May 1, 2006
      hi Manuel,

      in some of my scripts, i use

      $form->AddInput(array(
      "TYPE"=>"hidden",
      "NAME"=>"_submit_check",
      "VALUE"=>1,
      "ValidateAsInteger"=>1,
      "DiscardInvalidValues"=>1,
      ));

      if (array_key_exists('_submit_check', $_POST)){
      //do something if submitted
      }

      in order to check for forms submission.

      the reason i chose this method was that i read
      different browsers handle the enter key differently
      and this was supposed to make them act in a consistent
      manner (press enter = submit form).

      i notice that you use....

      $form->AddInput(array(
      "TYPE"=>"submit",
      "ID"=>"button_subscribe",
      "VALUE"=>"Submit subscription",
      "ACCESSKEY"=>"u"
      ));

      $form->LoadInputValues($form->WasSubmitted("doit"));
      if($form->WasSubmitted("doit")){
      do something if submitted
      }

      does the method you use take into account the
      different way different browsers handle the enter
      button?

      i'd like to use your method b/c 1. it is your class
      and you know better than i, 2. i am starting to
      implement some of the extra features of your class and
      it helps to be consistent with your code when i'm
      trying to understand it and 3. you might have some wiz
      bang feature in WasSubmitted() there that i don't know
      enough to know i'm missing.

      i want to make sure my users get consistent enter
      button behavior. of course, i'm talking about the
      keyboard enter button, not a for enter button.

      thanks,

      oe1

      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com
    • Manuel Lemos
      Hello, ... I don t think that is your problem. I check an hidden input with WasSubmitted, rather than the submit because depending on how you submit the forms,
      Message 2 of 2 , May 2, 2006
        Hello,

        on 05/01/2006 05:47 PM operationsengineer1@... said the following:
        > does the method you use take into account the
        > different way different browsers handle the enter
        > button?

        I don't think that is your problem.

        I check an hidden input with WasSubmitted, rather than the submit
        because depending on how you submit the forms, the submit the form you
        may not be able to figure if the submit input button was used.

        First the submit input must have a NAME attribute. Otherwise it is not
        passed to the field.

        Another problem may happen if you use Javascript form.submit() function,
        the submit input parameter is not set, even if you call it from the
        submit button ONCLICK event.

        If you use WasSubmitted with a hidden input, it always work regardless
        of how the form was submitted.


        --

        Regards,
        Manuel Lemos

        Metastorage - Data object relational mapping layer generator
        http://www.metastorage.net/

        PHP Classes - Free ready to use OOP components written in PHP
        http://www.phpclasses.org/
      Your message has been successfully submitted and would be delivered to recipients shortly.