Re: More M. Lemos's form class questions
| From: | Manuel Lemos | Date: | Sat, 28 Oct 2000 18:01:16 +0000 |
| Subject: | Re: More M. Lemos's form class questions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22463@lists.php.net to get a copy of this message | ||
Hello A.,
On 19-Oct-00 00:35:39, you wrote:
>You made me curious with your announcement, now I can
>hardly wait for the new version.
I am still struggling to make time to finish a bulk of requested features.
>In the mean time, is there any quick fix for the
>following challenges:
>1) Any example for ServerSideValidation?
>I don't seem to be able to trigger it.
You just need to pass the name of a global function to the
ValidationServerFunction and make it return 1 if the field is valid.
For instance I use this function in conjunction with the email validation
class to figure if the e-mail address is acceptable.
AddInput(
...
"ValidationServerFunction"=>"ValidateEmailBox"
...
);
Function ValidateEmailBox($email)
{
global $global_options;
$validator=new email_validation_class;
$validator->timeout=10;
$validator->localuser="info";
$validator->localhost="phpclasses.UpperDesign.com";
return($validator->ValidateEmailBox($email)!=0);
}
>2) How can I validate the following: A drop down
><select> box contains an item: other. If this is
>selected, the user is supposed to type into the next
>input field the value (of other).
>How can I validate that if selected 'other' then
>validate as not empty the next field?
I don't have a automatic solution for that. You may use
either a client side or server side function to check if
the value in the select field is set and then figure if
you are going to validate the other field.
>3) If validation of the whole form passed, is it
>somehow possible to format the layout of the output
>which is sent back with the submitted and accepted
>values?
>
>Eg.: If in the example above the other field is left
>blank (the user selected a value from the drop down
>menu), s/he did not need to use the 'other' field.
>After validation, would it be possible that the blank
>other field would not even show up? Or, if other is
>being specified, the unselected value of the drop down
>list would not show up - since these are complementing
>each other - only one of them is needed, like a radio
>button.
>Is it possible to achieve this with the current
>version?
You have the complete control over the layout. You may use a PHP conditional
statement (if) and only add the fields and data to the form output that you
want to show.
>4) How can I validate that the sum of 3 numeric input
>fields should not be more than 50? (Possibly with
>server side validation, instead of JavaScript.)
Again, client side or server side validation custom functions passed with
"ValidationClientFunction" or "ValidationServerFunction" parameters.
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--