This topic is locked

multi-choice in single field

1/30/2007 1:07:29 AM
PHPRunner General questions
N
nanohex author

Hi
I was wondering if you can help me.

  1. I have a set of say 5 tick boxes.
  2. the results must go into a single data field, seperated with a comma
  3. the name of hte tickbox will be in the field to help tick the correct box
    Does anyone now how to do this, more like multi-select boxbut for tickboxes.
    Thanks.

J
Jane 1/30/2007

Hi,
you can do it using some check box fields, one text field and Before record updated event on the Events tab.

Here is a sample code:

function BeforeEdit(&$values, $where)

{

$str = "";

if ($values["Field1"]==1)

$str = "Field1, ";

if ($values["Field2"]==1)

$str.= "Field2, ";

if ($values["Field3"]==1)

$str.= "Field3, ";

$values["TextField"] = $str;

return true;

}



where Field1, Field2 and Field3 are the checkboxes, TextField is the text field.