| View previous topic :: View next topic |
| Author |
Message |
ap
Joined: 08 Jan 2007 Posts: 21
|
Posted: Jan 18, 2007 9:54 pm Post subject: Only allow one choice checkbox at a time. |
|
|
| Is it possible to program the upload_form to only allow one selection in the checkboxes at a time? I have users who select two checkboxes; the system displays a generic window that says transfer complete. The user is not sure what happens and clicks again. Eventually, the file does get uploaded. Better if they are only allowed to make one selection at a time, if they choose the first one, then the others get blanked out, etc. |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 1107 Location: Undisclosed location
|
Posted: Jan 19, 2007 6:55 am Post subject: |
|
|
Good idea man! Will use radiobuttons.
To allow only one progress bar mode choose one checkbox and add
| Code: | | checked style="display: none;" |
to the end of tag.
After that you can comment/romove other checkboxes. |
|
| Back to top |
|
 |
ap
Joined: 08 Jan 2007 Posts: 21
|
Posted: Jan 19, 2007 4:03 pm Post subject: |
|
|
| Thanks, That worked if I only want one selected. However I need to give the users a choice and have them check only one and not both. Any quick fix ideas. |
|
| Back to top |
|
 |
ap
Joined: 08 Jan 2007 Posts: 21
|
Posted: Jan 19, 2007 4:30 pm Post subject: |
|
|
Hey, Just figured it out. Add the following to the upload_form.html script.
This first part gets placed before the </head> line.
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkBoxValidate(cb) {
for (j = 0; j < 2; j++) {
if (eval("document.F1Upload.box[" + j + "].checked") == true) {
document.F1Upload.box[j].checked = false;
if (j == cb) {
document.F1Upload.box[j].checked = true;
}
}
}
}
// End -->
</script>
Replace your checkboxes with this for each checkbox...
<Input type="checkbox" name="popup" id="box" onClick="javascript:checkBoxValidate(0)">
<Input type="checkbox" name="inline" id="box" checked onClick="javascript:checkBoxValidate(1)">
I only have two check boxes. If you are using all three, add and change the last checkbox to <Input type="checkbox" name="inline" id="box" checked onClick="javascript:checkBoxValidate(3)">. Also, the scirpt you placed at the top should be changed to <3 and so on for as many checkboxes as you have. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|