[FX.php List] Re: Checkbox
robhelleshoj at tiscali.dk
robhelleshoj at tiscali.dk
Thu Apr 6 04:13:26 MDT 2006
Derrick,
> I've never seen the selected/checked value placed in quotes before;
> what happens if you do the selected output without being in quotes
> (but make sure there's a space after the closing quote for the value
> parameter)?
That was part of the problem: there was no space before 'checked'.
> The only other thing I can think of is the difference in the way the
> value list and the actual values are formatted. The value list has
> different separators than the actual field with the checked values, I
> think.
>The valuelist can be changed into an array with split, using "," as
>separator. I am not sure how it is formatted in XML or how FX parses this.
>I need to dig more into this.
True. I used print_r to display the arrays and that way I found out, that I used
the wrong separator in the split function.
>The field with checked values should have each value separated
> by a return (\r), while the value list itself is an actual array, not
> a single field with some arbitrary separation character.
I used \n, not \r.
So the final code became:
<?PHP
$TRK=$Data['Trykkeri'][0];
$TRK2=split("\n",$TRK);
foreach($Vis2ListResult['valueLists']['Trykkeri'] as $key=>$value){
if(in_array($value,$TRK2)){ $Select="checked";}else{$Select="";} ?>
<input type="checkbox" name="Trykkeri" value="<?PHP echo $value; ?>" <?PHP echo
$Select;?>><?PHP echo $value;
}?>
Next phase is to use this to also update FileMaker.
Rob
More information about the FX.php_List
mailing list