View Full Version : Condition fails
jgillett
25-Feb-2009, 06:07 PM
Trying for a simple 'if - then - message' condition. Basically if field1 contains data then field2 must also contain data.
Looking at the docs and some posts here I came up with...
<input type="hidden" name="conditions" value=":@@IF@TimesTaken@DatesTaken@@Please provide date(s) test(s) taken.@" />
or
<input type="hidden" name="conditions" value="@IF@TimesTaken@DatesTaken@@Please provide date(s) test(s) taken.@" />
Filling in TimesTaken, but not DatesTaken, results in no error thrown by the form by either statement above. The form is at http://www.west.asu.edu/testing/matreg.html, FWIW. Bottom two fields.
What is this old grey head missing?
Thanks.
ginger23
25-Feb-2009, 09:30 PM
Try this:
<input type="hidden" name="conditions1" value=":@
@IF@TimesTaken@DatesTaken@@Please provide date(s) test(s) taken.@" />
It looks like you may need to put a number after the word conditions. Do you have any other condition statements set?
ginger
jgillett
25-Feb-2009, 10:35 PM
Hi Ginger,
Obviously a newbie with this form (but not with programming). Turns out to be my bad. I was testing with a completely blank form, filling in only the TimesTaken field. The script was burping with a missing realname and email, which means it didn't even get to the conditions.
So, my first example above was correct (no number needed - there are no other condition statements on this form). As soon as I filled in the rest of the form, except DatesTaken, I got my error message.
Thanks for your time! :)
ginger23
25-Feb-2009, 11:19 PM
Great!
I had tested the statement with a sample form (which had other conditions in my ini file, named conditions1, conditions2 and conditions3) and it failed using name="conditions" in the form, but conditions4 worked fine so I assumed that maybe you had other conditions in an ini file that might be interfering.
Anyway, glad you sorted it out.
jgillett
25-Feb-2009, 11:38 PM
Fiddling with the ini file will be a last ditch thing. The forms I'm using this script for are basically pretty simple, but I have a pile of real nasty stuff that's going to require some head-scratching when I get around to converting those to PHP (which I don't know - my bag is ColdFusion).
Thanks again.
jgillett
25-Feb-2009, 11:56 PM
Ginger, will this work...?
<input type="hidden" name="conditions" value=":@@IF@TimesTaken#>0@DatesTaken@@Please provide date(s) test(s) taken.@" />
In spite of a note on the form to the contrary, some folks insist on entering '0' (zero), which makes the test fail when they don't enter dates.
Thanks.
ginger23
26-Feb-2009, 01:11 AM
That should work . . . unless they enter something like "two", in which case the DatesTaken field won't be enforced. :D
You might want to consult with Russell about using regular expressions to define your conditions, unless you're experienced with them. (I'm not.)
ginger
jgillett
26-Feb-2009, 08:15 PM
You might want to consult with Russell about using regular expressions to define your conditions, unless you're experienced with them. (I'm not.)
ginger
I'm not either, and I'd rather leave it that way! :confused:
Thanks for the reply.
Powered by vBulletin® Version 4.1.4 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.