ciao
sto scrivendo una pagina con un form.
Il bottone di invio passa i dati inseriti ad una funzione in javascript che verifica che i valori siano diversi da null e anche se una checkbox é checked o no.
Il mio problema é proprio questa checkbox.
Se é checked vicino le compare un campo di testo.
Tutto funziona come dovrebbe. L'unico problema é che il valore scritto in quest'ultimo campo di testo scompare quando si procede con l'invio.
Codice:
function submitICR()
{
if (validate()==true)
{
$('form_icr').submit();
}
}
function submitFile(){
updateData();
$('formFileAttach').submit();
}
function validate(){
//experimental
var check=document.getElementById('ch').value;
//alert (check);
var allEmpty= $$("*.notEmpty[value='']");
var a = allEmpty.length;
allEmpty +=( $$("*.notEmpty:empty"));
if (check=="on")
{
document.getElementById("ch2").innerHTML = "<input type='text' name='co'> ( * )";
return false;
}
if (($$("*.notEmpty[value='']")!= '') || (allEmpty.length<a))
{
alert("The fields 'RFM Version' and 'Reason for Change' are mandatory ( * )");
return false;
}
if ((check=="on")&&(document.getElementById('co').val ue==""))
{
alert (document.getElementById('co').value);
alert ("If you checked the 'Request affecting other Interfaces' field, you have to specify which one");
return false;
}
return true;
}