Don't really understand the Validate Plugin, but you can use this to
validate if user selected newcolor or any other:

if(parseInt($('#color').val) === -1 && $('#newColor').val().length ===
0){
    /** user hasn't filled out a new color in #newColor when choose to
"Specify new color" **/
}else{
    /** uses has selected other color **/
}

..fredrik

On Jun 24, 2:52 pm, ciupaz <luigi.zambe...@gmail.com> wrote:
> Hi all,
> I have to validate a textbox if the user select a particular value in
> a combobox.
> For example, if the user select the "Specify new color" in the
> following combobox:
>
> <select id="color" name="color">
>        <option value="-1">Specify new color</option>
>        <option value="1">Red</option>
>        <option value="2">Green</option>
>        <option value="3">Blue</option>
>        <option value="4">White</option>
>        <option value="5">Black</option>
> </select>
>
> I have to validate the following textbox:
>
> <input id="newColor" name="newColor" type="text" />
>
> with the Validate Plugin:
>
> rules: {
>          newColor: {
>              required: ??????
>        },
>
> How can I accomplish this?
>
> Thanks in advance.
>
> Luis.

Reply via email to