Closed Thread Icon

Preserved Topic: Forcing dots in Radio's before moving on... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18457" title="Pages that link to Preserved Topic: Forcing dots in Radio&amp;#039;s before moving on... (Page 1 of 1)" rel="nofollow" >Preserved Topic: Forcing dots in Radio&#039;s before moving on... <span class="small">(Page 1 of 1)</span>\

 
sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-24-2001 18:58

Hi all,

I'm wanting to make a page with a "checklist" in it for our intranet.

People will have to go through a list of "have you done this?..." questions, putting a dot in each ones radio button to confirm that they've done it.

Only once they've dotted ALL the radios should they be allowed to click submit and move on to the next page...

Failing to select a couple would result in an alert box saying "you forgot to check "check1title" and "check2title"..

Anyone care to point me in the right direction?

I'm limited to Client Side Scripting only...

cheers all,

Pete.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 10-24-2001 19:59

if (formname.radioname.checked) alert("You didn't check one");''

Well thats the basics. For what you need to do where everyone needs to be checked.
missedbuttons = new Array;
for (i=0; forms[o].elements.length; i++) {
if (forms[0].elements[i].type == "radio") {
if (!forms[o].elements[i].checked) {
missedbuttons.push(forms[0].elements[i].value);
}
}
}


This will leave you with an array that has the values of all the missed buttons.
Nice for validation.



:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

[This message has been edited by bitdamaged (edited 10-24-2001).]

hlaford
Bipolar (III) Inmate

From: USA! USA! USA!
Insane since: Oct 2001

posted posted 10-25-2001 00:42

I've written a validation script which is great for stuff like this. You can use JavaScript to set up required fields or write it into the HTML itself if your browser standard supports some form of the DOM.

code:
<input type="radio" required="on" ... />

OR

document.myForm.myRadio.REQUIRED = true;



It sets up the onsubmit handlers for you so the job is pretty simplistic. It also has many other validation checks built into it and methods for adding checks at run-time.

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 10-25-2001 01:34

If I'm reading what you want to do correctly, sonicsnail, it sounds like you should be using checkboxes instead of radio buttons. They work perfectly for a list of items where one or more need to be checked off as opposed to radio buttons that are supposed to allow you to choose just one from many choices.

sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-25-2001 19:52

Thanks for the input everyone!.. however, they've moved the goalposts, and the job is slightly different now...

In short.. I have this... and I have to change the way it works...

The author created it so that the user would click on one of the entries in the <option>, then CTRL+click to add further ones.. and "template(s)" would appear in the <textarea> to be copied and pasted elsewhere...

The change I have to make seems pretty simple, but I think I have to mess with the variables and I'm not sure how to do it...

I have to replace the <option> box with mutliple <checkbox>'s, without losing the functionality. ie. Clicking the boxes will enter the relevant "templates" into the text area.

Anyone care to save my skin and send me on the right path?

Thanks in advance,

Pete

sonicsnail
Bipolar (III) Inmate

From: Scotland
Insane since: Jun 2001

posted posted 10-25-2001 22:07

Thanks anyway guys.. I was rescued from this by someone on a Javascript forum elsewhere... sorry to be disloyal but I was in a rush!

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 10-25-2001 22:16

What's this? A traitor! Seize him!

« BackwardsOnwards »

Show Forum Drop Down Menu