I'd personally advise against using 8-bit characters in javascript; my
experience is that such is not portable. Also, I trust that you are
still checking on the back end - it's relatively easy to disable
javascript.
To do this check without 8-bits, I believe the logic needs to be
reversed - what isn't legal. I much prefer to do the check the way
Embperl::Form::Validate does it, but I have the advantage of not having
to support non-ASCII email addresses.
Of course, you could always try saying IE isn't supported. ;>
Ed
On Mon, 3 Apr 2006, Florian 'cit' Adamsky wrote:
> Hello list,
>
> I've another problem! With Embperl::Form::Validate I generate a
> javascript and check if the e-mail address is valid. With firefox and
> mozilla it works very well, but the internet explorer (6.0.2) always
> say the e-mail address is not valid. Is the generated Javascript
> incompatible?
>
> Thanks in advance
> greets
> cit
>
> Here some code, but I don't think this can be the problem.
>
> ## my template
>
> use Embperl::Form::Validate;
> my $epf=Embperl::Form::Validate->new([[
> -key => 'email',
> emptyok => 1,
> -msg => 'no valid email
> address', -type => 'EMail',
> ]]
> );
>
> <script type="text/javascript" language="JavaScript">
> <!--
> [+ do { local $escmode = 0; $epf->get_script_code } +]
> //-->
> </script>
> <form action="user.tmpl" method="post" name="add_user" onSubmit="return
> epform_validate_forms_0_()">
>
> ## the generated javascript
> <script type="text/javascript" language="JavaScript">
> <!--
> function epform_validate_forms_0_()
> {
> var msgs = new Array ;
> var fail = 0 ;
> var i = 0 ;
> var obj ;
>
> do {
>
> do {
>
> do {
> obj = document.forms[0]['email'] ; if (!(obj.value)) { break;}
> obj = document.forms[0]['email'] ; if (!(((obj.value.search(/^[^
> <>()@[EMAIL PROTECTED] <>()@¡-ÿ]+\.[a-zA-Z]{2,4}$/) >= 0) &&
> (obj.value.search(/@(\.|.*(\.\.|@))|mailto:/i) < 0))))
> { msgs[i++]='keine gültige E-Mail Adresse'; break;} } while (0) ; if
> (fail) break ; } while (0) ; if (fail) break ;
> ;
> }
> while (0) ;
> if (i)
> alert (msgs.join('\n')) ;
>
> return !i ;
> }
> //-->
> </script>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]