Javascript form Validation on Radio Button Help

Started on the old forum in March 2012 · view the original in the archive · old links redirect here

1 reply · 564 views · started 14 years ago · 1 min read

2 participants
johnwboyd Junior · 12 posts #1

When I try to add the validation for if the 1st, 2nd, or 3rd radio button is selected the respective field is required, it is somehow making it required even when that field is not selected. For example, I select the first one and then the credit card details on the 2nd one are required.

Form example: Order Check Out

The javascript: http://nonvoiceprocess.net/cart_test/cartx.js

If you can give me the script to add to the js file I'd really appreciate it. I gave my best and just couldn't get it.

Thanks in advance.

something else Fellow · 2,296 posts #2

your nearly there.... heres a start to it:

if(document.getElementById("m-p").checked && document.getElementById("m-p-1").value == "")
{
   document.getElementById("selectx").focus();
		document.getElementById('selectx').style.display="block";
		return false;
}

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close