Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

conditional select validation

Posted 01 Jul 2002 18:37:16
1
has voted
01 Jul 2002 18:37:16 Santo Peroni posted:
I need a conditional javascript select validation. So if the user does not select anything on the select, wich has value -1 he gets tha alert box on submiting the form.

How do you say if select -1 then field required?

Replies

Replied 01 Jul 2002 18:43:25
01 Jul 2002 18:43:25 Brent Colflesh replied:
Dear Santoni,
What about attaching the built-in DW Validation behavior to your form?

Regards,
Brent

Replied 01 Jul 2002 18:53:01
01 Jul 2002 18:53:01 aegis kleais replied:
if (document.all.selectBoxName.value = "na" {
alert("You need to select something";
return false;
}

This is if you give the default value of the select box "na" for it's value
or

if (document.all.selectBoxName.index = -1) {
alert("You need to select something";
return false;
}
Replied 02 Jul 2002 10:54:10
02 Jul 2002 10:54:10 Santo Peroni replied:
Mr. bcolflesh, the dreamweaver validation as is does not work with conditional select.

Aegiskleais can this code be incorporated in the form tag, together with the standart dw validation?
Replied 02 Jul 2002 18:55:49
02 Jul 2002 18:55:49 aegis kleais replied:
Yes, you just have to find where the validation code is up in the head tag. You have to familiar enough with javascript to know where you can insert the code. Returning false will still prevent the user from moving forward. You would also have to add the line to the alert box if/when the issue comes up where they didn't make a selection.
Replied 03 Jul 2002 01:46:59
03 Jul 2002 01:46:59 Santo Peroni replied:
Thanks for your help Aegiskleais.

I found I good extension for form validation of selects, checkboxes, etc.

If anyone has the same problem I have had, you find the form validation ext. at
www.yaromat.com

Reply to this topic