|
Posted by Robert Amos on 04/10/05 11:45
You don't need to include {literal}{/literal} statements around simple
javascript statements when the source is in another file, ie:
{literal} <script language="JavaScript" src="js/validator.js"
type="text/javascript"></script>{/literal}
You're also including js/validator.js twice in that file, is that the
wanted behaviour?
In order to know anything more, you need to tell us what it is doing
correctly and what is going wrong.
-bok
On Apr 10, 2005 6:23 PM, Reynier Perez Mira <rperezm@estudiantes.uci.cu> wrote:
> I read Smarty doc and I see that literal it's use for work with JavaScript code. So, take a look to my tpl file and view why JavaScript does'n work:
>
> register.tpl
>
> {literal} <script language="JavaScript" src="js/validator.js" type="text/javascript"></script>{/literal}
> <tr><td class="padding-tb"><div align="center">
> <form action="accion.php?mod=new_user" method="post" enctype="multipart/form-data" name="register_form" id="register_form" a>
> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
> <tr>
> <td colspan="2" align="center" class="th">{$U_NEW_REGISTER}</td>
> </tr>
> <tr>
> <td colspan="2" align="center" class="topnav">{$OBLIGATORIEDDATA}</span></td>
> </tr>
> <tr>
> <td width="31%" align="right">{$UNAME}</td>
> <td width="69%" align="left"><input name="uname" type="text" id="uname" size="25" maxlength="25"></td>
> </tr>
> <tr>
> <td align="right">{$UCORREO}</td>
> <td align="left"><input name="utcorreo" type="text" id="utcorreo" size="50" maxlength="250"></td>
> </tr>
> <tr>
> <td align="right">{$UNICK}</td>
> <td align="left"><input name="unickname" type="text" id="unickname" size="35" maxlength="35" onClick="emailCheck(document.register_form.utcorreo.value);"></td>
> </tr>
> <tr>
> <td align="right">{$UPASS1}</td>
> <td align="left"><input name="upass1" type="password" id="upass1" size="35" maxlength="250">
> <input name="uencpass" type="hidden" id="uencpass"></td>
> </tr>
> <tr>
> <td align="right">{$UPASS2}</td>
> <td align="left"><input name="upass2" type="password" id="upass2" size="35" maxlength="250"></td>
> </tr>
> <tr>
> <td colspan="2" align="center">{$UPASSB}</td>
> </tr>
> <tr>
> <td align="right"> </td>
> <td>{$SECURITYCODE}</td>
> </tr>
> <tr>
> <td colspan="2" align="center" class="topnav">{$OTROSDATOS}</td>
> </tr>
> <tr>
> <td align="right">{$UICQ}</td>
> <td align="left"><input name="uicq" type="text" id="uicq" size="16" maxlength="16"></td>
> </tr>
> <tr>
> <td align="right">{$UYIM}</td>
> <td align="left"><input name="uyim" type="text" id="uyim" size="25" maxlength="35"></td>
> </tr>
> <tr>
> <td align="right">{$UMSN}</td>
> <td align="left"><input name="umsn" type="text" id="umsn" size="25" maxlength="35"></td>
> </tr>
> <tr>
> <td align="right">{$UAOL}</td>
> <td align="left"><input name="uaol" type="text" id="uaol" size="25" maxlength="35"></td>
> </tr>
> <tr>
> <td align="right">{$USWWW}</td>
> <td align="left"><input name="uweb" type="text" id="uweb" size="50" maxlength="500"></td>
> </tr>
> <tr>
> <td valign="top" align="right">{$UINTERESES}</td>
> <td align="left"><textarea name="uintereses" cols="35" rows="5" wrap="VIRTUAL" id="uintereses"></textarea></td>
> </tr>
> <tr>
> <td valign="top" align="right">{$UOCUPACION}</td>
> <td align="left"><textarea name="uocupacion" cols="35" rows="5" wrap="VIRTUAL" id="uocupacion"></textarea></td>
> </tr>
> <tr>
> <td valign="top" align="right">{$UFIRMA}</td>
> <td align="left"><textarea name="ufirma" cols="35" rows="5" wrap="VIRTUAL" id="ufirma"></textarea></td>
> </tr>
> <tr>
> <td colspan="2" align="center"><input name="umailpublic" type="checkbox" id="umailpublic" value="1" checked>
> {$UPCORREO}</td>
> </tr>
> <tr>
> <td colspan="2" align="center"><input name="unotifiymail" type="checkbox" id="unotifiymail" value="1">
> {$UNCORREO}</td>
> </tr>
> <tr>
> <td align="right">{$UAVATAR}</td>
> <td align="left"><input name="uavataruploaded" type="file" id="uavataruploaded" size="35"></td>
> </tr>
> <tr>
> <td colspan="2" align="center"><input name="ubtn_send" type="submit" id="ubtn_send" value="{$UREGISTER}"></td>
> </tr>
> <tr>
> <td colspan="2" align="center"> </td>
> </tr>
> </table>
> </form></div>
> {literal}
> <script language="JavaScript" src="js/validator.js" type="text/javascript"></script>
> <script language="JavaScript">
> function MatchValidation(){
> var frm = document.forms["register_form"];
> if(frm.upass1.value != frm.upass2.value){
> alert('Las contraseñas no coinciden!');
> return false;
> }else{
> return true;
> }
> }
> var frmvalidator = new Validator("register_form");
>
> frmvalidator.addValidation("uname","req","Debes entrar tu nombre y apellidos antes de continuar con el registro");
>
> frmvalidator.addValidation("utcorreo","minlen=5","El correo electrónico debe tener más de 5 carácteres");
> frmvalidator.addValidation("utcorreo","req","Debes entrar tu correo electrónico antes de continuar con el registro");
> frmvalidator.addValidation("utcorreo","email","Debes escribir una dirección de correo electrónico");
>
> frmvalidator.addValidation("unickname","minlen=5","El nomrbe de usuario debe tener más de 5 carácteres");
> frmvalidator.addValidation("unickname","req","Debes entrar tu nombre de usuario antes de continuar con el registro");
>
> frmvalidator.addValidation("upass1","minlen=5","La contraseña de usuario debe tener más de 5 carácteres");
> frmvalidator.addValidation("upass1","req","Debes entrar tu contraseña antes de continuar con el registro");
> frmvalidator.addValidation("upass2","minlen=5","La contraseña de usuario debe tener más de 5 carácteres");
> frmvalidator.addValidation("upass2","req","Debes entrar tu contraseña antes de continuar con el registro");
>
> frmvalidator.setAddnlValidationFunction("MatchValidation");
> </script>
> {/literal}
> </td>
> </tr>
>
> What's wrong?
>
> Regards
>
> Reynier Pérez Mira
>
> 3ero. Ing. Informática
>
> Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy.
>
>
--
Xnyo - http://xnyo.odynia.org/
Navigation:
[Reply to this message]
|