RE: [Phplib-users] How to validate a oohform with js ?
Brought to you by:
nhruby,
richardarcher
|
From: Benjamin H. <ho...@eu...> - 2002-10-31 13:15:34
|
hmm the validation works
but i have another problem :(
Warning: Variable passed to reset() is not an array or object in =
/var/www/html/php/of_text.inc on line 73
Warning: Variable passed to each() is not an array or object in =
/var/www/html/php/of_text.inc on line 74
this happens when i enter a javascript Name if i make no javascript =
validation everything works fine.
i tested it with "phplib-0.74.20021008.patches" and the version 7.4 =
only the line number differs
Warning: Variable passed to reset() is not an array or object in =
/var/www/html/php/of_text.inc on line 67
Warning: Variable passed to each() is not an array or object in =
/var/www/html/php/of_text.inc on line 68
with version 7.4=20
it=B4s these two lines=20
reset($ndx_array);
while (list($k, $n) =3D each($ndx_array)) {
any suggestions why this happens ?
is it possible that i use javascript validation with template=B4s ?
hmm maybe someone know=B4s the answer
best regards Benjamin=20
> ----------
> From: Taylor, Stewart[SMTP:Ste...@uk...]
> Sent: 30 October 2002 16:49
> To: 'Benjamin Hoft'
> Cc: 'Php...@li...'
> Subject: RE: [Phplib-users] How to validate a oohform with js ?
>=20
> $f =3D new form;
>=20
> $f->add_element(....
> ...
>=20
> =20
> $f->start("MyFunction","POST","index.php","","FormName");
> ^^^^ This parameter specifies that you
> want to create a form onsubmit javascript function.
> ...
>=20
> $f->finsh("",
> "
> if (f.input1.value=3D=3D'' && f.input2.value=3D=3D'')
> {
> alert('your message');
> return false;
> }
> "
> );
>=20
> Use the finish function to put none phplib generated code into the =
onsubmit
> function.
> i.e. function finish($after, $before)
>=20
> Therefore, the above call will add onsubmit attribute to the form tag
>=20
> <FORM ......."onsubmit"=3D"return MyFunction_Validator(this)">
> ...
>=20
>=20
> And generate the javascript function code.
> <SCRIPT>
> function MyFunction_Validator(f)
> {
> // $before
> if (f.input1.value=3D=3D'' && f.input2.value=3D=3D'')
> {
> alert('your message');
> return false;
> }
>=20
> phplib generated javascript code
> =20
> =20
> // $after
> =20
> ...
> }
> </SCRIPT>
> ...
>=20
>=20
>=20
>=20
> -Stewart
>=20
> -----Original Message-----
> From: Benjamin Hoft [mailto:ho...@eu...]
> Sent: 30 October 2002 15:27
> To: 'Php...@li...'
> Subject: [Phplib-users] How to validate a oohform with js ?
>=20
>=20
> How can i validate if either one or the other of two textfields (or =
both)
> is being fillied with some sort of text ?
>=20
> normally i would use js with a script like this:
>=20
> <SCRIPT>
> function validate()
> {
> if (document.form.input1.value=3D=3D"" &&
> document.form.input2.value=3D=3D"")
> {
> alert ("please insert some text in one of the input fields");
> }
> else
> {
> document.form.submit();
> }
> }
> </SCRIPT>
>=20
> and use this function on a link
>=20
> <a href=3D"javascript:Validate();">submit</a>
>=20
> but how can i do that with phplib, with oohforms and templates ?
>=20
> i couly only validate both fields if they are empty, but what if only =
one
> must be entered with text ?
>=20
>=20
> best regards Benjamin
>=20
>=20
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Phplib-users mailing list
> Php...@li...
> https://lists.sourceforge.net/lists/listinfo/phplib-users
>=20
|