123GoToAndPlay
Aug 10th 2007, 1:48 am
So i created a form which has some xtra input fields shown/hidden depending on an user's input.
But how can i use a correct javascript validation for this form.
At the moment the validation only works:
A/ when the extra input fields are hidden (at start)
Furthermore, i like to validate the xtra input fields if they are shown. If i just validate the inputfield it seems to work, but when i hide the input fields it still want to validate the input fields??
btw this code i am using for show/hide
function hide(id) {
document.getElementById(id).style.visibility = 'hidden';
document.getElementById(id).style.display = 'none';
}
function show(id) {
document.getElementById(id).style.visibility = 'visible';
document.getElementById(id).style.display = 'block';
}
Any advice
But how can i use a correct javascript validation for this form.
At the moment the validation only works:
A/ when the extra input fields are hidden (at start)
Furthermore, i like to validate the xtra input fields if they are shown. If i just validate the inputfield it seems to work, but when i hide the input fields it still want to validate the input fields??
btw this code i am using for show/hide
function hide(id) {
document.getElementById(id).style.visibility = 'hidden';
document.getElementById(id).style.display = 'none';
}
function show(id) {
document.getElementById(id).style.visibility = 'visible';
document.getElementById(id).style.display = 'block';
}
Any advice