|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Form validation, prevent duplicate entries
Hello-
I have a form with 20 radio button groups ("names"), each with 5 choices ("values"). Some choices are the same in more than one group, but the user is not supposed to select any one choice more than once. For example: group A may have choices a,b & c and group B may also have the choices a,b & c. The user should be NOT be able to select choice a for both button group a and group b. In other words each of the 100 possible choices should be unique. Is there a quick way using either php or javascript to pop-up a warning and stop the form submission if the user selects any choice more than once, without having to write code for each of the 100 possibilities? Thanks. |
|
#2
|
||||
|
||||
|
RE: Form validation, prevent duplicate entries
This would have to be javascript based to prevent form submission. Try searching for form validation. However it could be worth noting that if you do use javascript you may or may not want to make a php based checker aswell to make sure that everything went according to plan. Ill move this thread to clientside where it is better suited
|
|
#3
|
|||
|
|||
|
Message Moved
Thread moved from 'PHP Coding' to 'Client Side Things' by Andrew.
Reason: |
|
#4
|
||||
|
||||
|
RE: Form validation, prevent duplicate entries
i personally would recommend a php solution, optional supported by JavaScript, since i can switch JS off, and submit the form regardless of any validation scripts.
A php validation is easily implemented by just walking through all submitted checkbox groups and checking via foreach() if the current value is somewhere in the other submitted groups ( in_array() ) |
|
#5
|
||||
|
||||
|
RE: Form validation, prevent duplicate entries
yes but he did state he wanted to stop the form from being submitted. Php cannot do this, however php can provide a very good backup just incase.
|
|
#6
|
||||
|
||||
|
RE: Form validation, prevent duplicate entries
uh-oh. i thought he meant "stop from being processed".
so, sorry, I misunderstood it |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Form validation, prevent duplicate entries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|