More Than One Dependent

38 views
Skip to first unread message

trojanfresh

unread,
May 1, 2012, 2:22:19 PM5/1/12
to ValidateThis
I have a question/problem

I am using a checkbox value="yes" i couldn't get conditions to work
correctly so i went with this route.

if <input type="checkbox" id="removePay" name="removePay" value="Yes">
or
<input type="checkbox" id="changeRate" name="changeRate" value="Yes">

Is checked

then Require

a field

I tried this no luck as i said before i tried using clientside code
and no luck either.
<property name="newTotalBilled" desc="New Total Billed">
<rule type="required" contexts="*"
failureMessage="If You Selected Remove Pay Please Fill This In">
<param name="DependentPropertyName" value="removePay" />
<param name="DependentPropertyValue" value="Yes" />
</rule>
<rule type="required" contexts="*"
failureMessage="If You Selected Change Rate Please Fill This In">
<param name="DependentPropertyName" value="changeRate" />
<param name="DependentPropertyValue" value="Yes" />
</rule>
</property>

This really is a problem as everything else is great i just can't for
the life of me figure out how to check if either or is checked require
a field

John Whish

unread,
May 2, 2012, 3:54:50 AM5/2/12
to valida...@googlegroups.com
Hi,

I don't think you can have two required rules in the same property. Instead try something like:

<?xml version="1.0" encoding="UTF-8"?>
<validateThis xsi:noNamespaceSchemaLocation="validateThis.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<conditions>
<condition name="DoSomething" 
serverTest="getRemovePay() EQ 'Yes' OR getChangeRate() EQ 'Yes'"
clientTest="$('[name=removePay]').getValue() == 'Yes' || $('[name=changeRate]').getValue() == 'Yes';" />
</conditions>
<objectProperties>
<property name="newTotalBilled" desc="New Total Billed"> 
<rule type="required" condition="DoSomething"/>
</property>
</objectProperties>
</validateThis>


--
You received this message because you are subscribed to the Google Groups "ValidateThis" group.
To post to this group, send email to valida...@googlegroups.com.
To unsubscribe from this group, send email to validatethis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/validatethis?hl=en.


trojanfresh

unread,
May 3, 2012, 11:11:32 AM5/3/12
to ValidateThis
Thanks

On May 2, 3:54 am, John Whish <john.wh...@googlemail.com> wrote:
> Hi,
>
> I don't think you can have two required rules in the same property. Instead
> try something like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <validateThis xsi:noNamespaceSchemaLocation="validateThis.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <conditions>
> <condition name="DoSomething"
> serverTest="getRemovePay() EQ 'Yes' OR getChangeRate() EQ 'Yes'"
> clientTest="$('[name=removePay]').getValue() == 'Yes' ||
> $('[name=changeRate]').getValue()
> == 'Yes';" />
> </conditions>
> <objectProperties>
>  <property name="newTotalBilled" desc="New Total Billed">
>  <rule type="required" condition="DoSomething"/>
>  </property>
> </objectProperties>
> </validateThis>
>
Reply all
Reply to author
Forward
0 new messages