[phorm] [Phorm:] Parsing an array?

  • From: webbbs@xxxxxxxxx
  • To: support@xxxxxxxxx
  • Date: 5 Aug 2004 12:56:27 -0000

The following new message has been posted on Phorm Support Forum at 
<http://www.phorm.com/support/>. 

*************************************************************************** 

  MESSAGE:  (#4231) Parsing an array? 
            <http://www.phorm.com/support/?rev=4231> 
  AUTHOR:   Bob Brody 
  DATE:     August 5, 2004 at 8:56 a.m. EST 

I have a situation where I have, say, five check boxes in a group. It's an 
array and each box is, say, a color. 

<INPUT TYPE=CHECKBOX NAME="colors[]" value="red"> 
<INPUT TYPE=CHECKBOX NAME="colors[]" value="green"> 
<INPUT TYPE=CHECKBOX NAME="colors[]" value="blue"> 
<INPUT TYPE=CHECKBOX NAME="colors[]" value="pink"> 
<INPUT TYPE=CHECKBOX NAME="colors[]" value="white"> 

I then have another group, say, fabric. 

<INPUT TYPE=CHECKBOX NAME="fabric[]" value="silk"> 
<INPUT TYPE=CHECKBOX NAME="fabric[]" value="cotton"> 
<INPUT TYPE=CHECKBOX NAME="fabric[]" value="rayon"> 
<INPUT TYPE=CHECKBOX NAME="fabric[]" value="wool"> 
<INPUT TYPE=CHECKBOX NAME="fabric[]" value="burlap"> 

The user has to choose at least one choice from at least one group (i.e., they 
don't have to choose something from colors AND from fabric but they do have to 
choose at least something from colors OR fabric. 

Okay, that works. Now the rub is, there is a yes/no radio buttons question 
later into the form that has relevance to which if any color they chose, 
specifically, red. 

Thus, if they chose red, then I want to make that subsequent yes/no question 
(let's call its value "daquestion") a required field, but only if they chose 
red. Otherwise daquestion need not be required. 

So in non programming lingo, something such as: 

If colors = true AND red = true, then daquestion is required (you must answer 
either yes or no). Otherwise, you don't have to answer daquestion. 

What I haven't figured out is how do I find out if "red" has been checked off 
in "colors" assuming anything at all has been checked off in "colors". No 
problem testing to see that colors has been checked: 

if colors != "" 

but can I then also continue to find out what colors does equal if it does not 
equal nothing? 

if colors != "" 
and colors == red 
then daquestion becomes required 

Is something like that possible? 

Bob 

*************************************************************************** 

This is an automatically-generated notice.  If you'd like to be removed from 
the mailing list, please visit Phorm Support Forum at 
<http://www.phorm.com/support/>, or send your request to webbbs@xxxxxxxxxx  If 
you wish to respond to this message, please post your response directly to the 
board.  Thank you! 
-------------------------------------------------
You are receiving this message because you are subscribed to the Phorm mailing 
list. To send messages to the mailing list, simply send email to 
phorm@xxxxxxxxxxxxx from the address you have subscribed. You may unsubscribe 
from the list by sending email to phorm-request@xxxxxxxxxxxxx with 
'unsubscribe' in the SUBJECT field.

Other related posts:

  • » [phorm] [Phorm:] Parsing an array?