function testPayMethod()
{
f = document.payform;
var radioCheck = false;
                
var firstEl = 0;
var lastEl = 3;

for (i=firstEl;i<lastEl;i++) 
{
if (f.elements[i].checked == true)
{
radioCheck = true;
}
}

if (!radioCheck)
{
//No radio buttons were selected
alert('select at least one radio');
return false;
}
else if ((f.elements[0].checked | f.elements[1].checked) &&
f.trooptaxnumber.value.length == 0)
{
//One of the first two radios was selected but no text in the text field
alert("one of the first 2 are selected, but nothing is in the text field");
return false;
}
else
{
//Everything is fine
return true;
}
}

The function returns either true or false so make your <form>'s onsubmit
this...

Onsubmit="return testPayMethod();"

The firstEl is the position of the first radio button and lastEl is the
position of the last radio button. Should make it easier to move the radios
around in the form or add more later.

This is probably gonna come through all garbled but ill give it a shot. :/

..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com

-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 22, 2005 5:22 PM
To: CF-Talk
Subject: RE: OT: Prevent form submission if radio button and text field are
not filled out

Well, I'm not really sure what I'm saying. I just need for the form to
submit if both of the criteria are met. If you select one of the bottom two,
the full form works just fine.

<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Kiley Simpson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 22, 2005 4:18 PM
To: CF-Talk
Subject: Re: OT: Prevent form submission if radio button and text field
are not filled out


Are you saying you need a DHTML script to reactivate the submit button if
the Troop T.E.N. value is not null and either Troop radio button is
selected?

At 03:02 PM 11/22/2005, you wrote:
>Anyone have any ideas?
>
>I've cut out a portion of a form on which I'm working:
>http://www.andyandjaime.com/uploads/radiojs.html
>
>It's supposed to pop an alert box (and disable the form) when you click
>"check out" IF
>a) You've got either of the top two options (troop check or troop debit)
>selected
>AND
>b) The tax exempt number is not filled in
>
>This part works fine, but it's ALSO supposed to reactivate the form once
>you've filled both of those requirements and it's not doing that.
>
>Does anyone have any ideas as to what's wrong? I'm sure it's something
>simple, but I don't know what it might be.
>
><!----------------//------
>andy matthews
>web developer
>ICGLink, Inc.
>[EMAIL PROTECTED]
>615.370.1530 x737
>--------------//--------->
>
>
>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225032
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to