A12 Web Studio
posted this
03 June 2023
Ok,
I will add it with javascript, it is possible? If yes how.
I have two fields
and this is the javascript
function CompareFields(f1, f2, caseinsensitive)
{
var val1 = document.getElementById(f1).value;
var val2 = document.getElementById(f2).value;
if( caseinsensitive )
{
val1 = val1.toUpperCase();
val2 = val2.toUpperCase();
}
val1 = val1.replace(/^\s*/,"");
val1 = val1.replace(/\s*$/,"");
if( val1.length == 0 ) { return; }
val2 = val2.replace(/^\s*/,"");
val2 = val2.replace(/\s*$/,"");
if( val2.length == 0 ) { return; }
if( val1 == val2 ) { return; }
alert("The form fields need to be identical.");
}
but how can I insert these into the form?
Thanks
Nancy
Ok,
I will add it with javascript, it is possible? If yes how.
**I have two fields**
**and this is the javascript**
function CompareFields(f1, f2, caseinsensitive)
{
var val1 = document.getElementById(f1).value;
var val2 = document.getElementById(f2).value;
if( caseinsensitive )
{
val1 = val1.toUpperCase();
val2 = val2.toUpperCase();
}
val1 = val1.replace(/^\s*/,"");
val1 = val1.replace(/\s*$/,"");
if( val1.length == 0 ) { return; }
val2 = val2.replace(/^\s*/,"");
val2 = val2.replace(/\s*$/,"");
if( val2.length == 0 ) { return; }
if( val1 == val2 ) { return; }
alert("The form fields need to be identical.");
}
but how can I insert these into the form?
Thanks
Nancy