You are here: Re: [PHP] Validating Radio Buttons in two directions « PHP « IT news, forums, messages
Re: [PHP] Validating Radio Buttons in two directions

Posted by John Nichel on 10/04/01 11:37

tedd wrote:
>> How do I assure that only one color is ranked at any one value?
>>
>> I hope my question makes sense. Any help will be appreciated.
>>
>> Thanks in advance.
>>
>> HiFi Tubes
>
>
> HiFi:
>
> I understand your problem, you don't want the user to pick a color such
> that it ranks the same as another color (i.e., only one gets a
> number-one ranking, only one gets a number-two ranking and so on).
>
> In php you can detect what the user picked AFTER they submit the form
> (click submit) and then redirect them back with an explanation "Hey, you
> made a mistake -- this is what you are supposed to do." And then, hope
> they do it right next time. However, that's against normal (or at least
> my) GUI.
>
> IMO, what you need to do is client-side checking, namely javascript. You
> need to have a routine that checks what the user selects as the user
> selects it -- this can't be done in php -- it can only be done server-side.
>
> I give you a hint, you should investigate:
>
> <input TYPE="radio" NAME="button" onClick="<whatever>"></td>
>
> The routine should simply un-check a previously checked button.
>
> HTH's
>
> tedd
>

Huh? Maybe I'm just not awake this morning and not understanding what
you're trying to explain, but if you're using *radio* buttons, only
*one* of the same name can be checked at any give time. ie:

<input type="radio" name="color" value="1" /> Blue
<input type="radio" name="color" value="2" /> Red
<input type="radio" name="color" value="3" /> Black
<input type="radio" name="color" value="4" /> Green
<input type="radio" name="color" value="5" /> Mauve

If you click "Red" and "Blue" is already selected, "Blue" will
automatically be unselected. It's basic HTML.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnichel@dotcomholdingsofbuffalo.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация