Would likt to request advise on how to extract a value from a multiselect variable:
I have used the multi-select combo box to create a new multi-variable. Now I would like to request one field value of this variable. If requesting the second field, could it be something similar to {VARIABLENAME [2]} ?
I'm trying to use the conditional 'contains' but for this type of file (multi-select combo box type) this conditional always gives me a true value also when the field is empty. Can this conditional work also for this type of field ?
What does a plain {TEMPLATEVARIABLENAME} in the template show? That's blank, and it evaluates as true? Would be oddly illogical, but you could always nest it as <IF {TEMPLATEVARIABLENAME}> <IF {TEMPLATEVARIABLENAME} contains x> x is one of the selections </IF> </IF>
Edit: When it's blank, I think what it ought to give is a php error saying it's empty. Not sure about that though, that might be when the other term is empty.
Paul, Something strage: I have a variable with the following value: " I Reg, II Reg, III Reg" Using <IF {VARIABLENAME} contains II Reg> TEXT </IF> this returns error Using <IF {VARIABLENAME}contains II Reg> TEXT </IF> this returns no error but always true value (no space between } and contains Searching on php I have found the following code to make the job: <?php if (eregi( ' II Reg' , '{VARIABLENAME}' )) { print "TEXT"; } ?> note the space left before the II Reg. eregi is not case sensitive.
Comments on mulltiselect value to extract
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Would likt to request advise on how to extract a value from a multiselect variable:
I have used the multi-select combo box to create a new multi-variable. Now I would like to request one field value of this variable. If requesting the second field, could it be something similar to {VARIABLENAME [2]} ?
Thank you in advance.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I believe you'll have to use conditionals. For example,
<IF {TEMPLATEVARIABLENAME} contains x>
x is one of the selections
</IF>
I'm not sure what "requesting the second field" would mean.
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Paul,
I'm trying to use the conditional 'contains' but for this type of file (multi-select combo box type) this conditional always gives me a true value also when the field is empty. Can this conditional work also for this type of field ?
Thank you.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
What does a plain {TEMPLATEVARIABLENAME} in the template show? That's blank, and it evaluates as true? Would be oddly illogical, but you could always nest it as
<IF {TEMPLATEVARIABLENAME}>
<IF {TEMPLATEVARIABLENAME} contains x>
x is one of the selections
</IF>
</IF>
Edit: When it's blank, I think what it ought to give is a php error saying it's empty. Not sure about that though, that might be when the other term is empty.
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Paul,
Something strage:
I have a variable with the following value: " I Reg, II Reg, III Reg"
Using <IF {VARIABLENAME} contains II Reg> TEXT </IF>
this returns error
Using <IF {VARIABLENAME}contains II Reg> TEXT </IF>
this returns no error but always true value (no space between } and contains
Searching on php I have found the following code to make the job:
<?php
if (eregi( ' II Reg' , '{VARIABLENAME}' )) {
print "TEXT";
}
?>
note the space left before the II Reg. eregi is not case sensitive.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
The space in yoru II Reg is probably the issue.