i how get the form's elements from Java script?

thanks

i have a page that it verify if the password and confirm password user's, it are matches.

sorry my english

and i have this script tag into jsf page:

<ui:script binding="#{newPage.script1}" id="script1" url="chequeador.js"/>

and the file chequeador.js contain:

function chequeador(form) {

var password = form["form1:clave"].value;

var passwordConfirm = form["form1:claveConf"].value;

if (password == passwordConfirm)

form.submit();

else

alert("Password and password confirm fields don't match");

}

but this not work. i find my error

thanks for you help.

[665 byte] By [scraftera] at [2007-11-27 8:21:46]
# 1

Hi!

Try just to add following code in your JSP page:

<script><![CDATA[

function chequeador(form) {

var claveField = document.getElementById("form1:clave");

var claveConfField = document.getElementById("form1:claveConf");

var password = claveField.value;

var passwordConfirm = claveConfField.value;

if (password == passwordConfirm)

form.submit();

else

alert("Password and password confirm fields don't match");

}

]]></script>

Probably it helps You.

Thanks,

Roman.

-Grif-a at 2007-7-12 20:10:19 > top of Java-index,Development Tools,Java Tools...