Webmastersite.net
Register Log In

mulltiselect value to extract
advise requested

Comments on mulltiselect value to extract

peumus
Forum Regular

Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile

Total Topics: 172
Total Comments: 462
peumus
Posted Mar 30, 2005 - 9:04 PM:

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.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Mar 31, 2005 - 5:43 AM:

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.
peumus
Forum Regular

Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile

Total Topics: 172
Total Comments: 462
peumus
Posted Apr 02, 2005 - 12:27 AM:

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.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 02, 2005 - 4:34 AM:

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.
peumus
Forum Regular

Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile

Total Topics: 172
Total Comments: 462
peumus
Posted Apr 03, 2005 - 7:16 PM:

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.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 04, 2005 - 10:29 AM:

The space in yoru II Reg is probably the issue.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.