Hi,
Specifying a value against each option seems to work fine if the values are non-sequential eg 7, 11, 16 but not if they are sequential.
I specified 0,1,2,3 but the values pulled into computed fields and the database are actually 1,2,3,4.
I worked around the problem for now but will try and post a solution once I have more time.
I suspect it is something going wrong in the construction of the array - you can see the html created is wrong.
A.
[SOLVED] Form Builder - PullDownFields
[SOLVED] Form Builder - PullDownFields
Last edited by andym on Wed Jan 02, 2008 11:34 pm, edited 1 time in total.
Re: Form Builder - PullDownFields
Hi,
OK - I think this is solved.
Line 55 in ComputedField.class.php
It does not deal with the fact that the value in a pulldownfield is not the value of the selection so I modified the code as follows:
if ($others[$ref]->GetFieldType() == 'PulldownField') //cwf mod 20080102
{ //cwf mod 20080102
$cwf_sel = $others[$ref]->GetValue()-1; //cwf mod 20080102
$cwf_val = $others[$ref]->GetOptionElement('option_value',
$cwf_sel, $default=""); //cwf mod 20080102
$procstr = str_replace('$fld_'.$tF,$cwf_val,$procstr); //cwf mod 20080102
} //cwf mod 20080102
else //cwf mod 20080102
{ //cwf mod 20080102
if (is_numeric($others[$ref]->GetValue()))
{
$procstr = str_replace('$fld_'.$tF,
$others[$ref]->GetValue(),$procstr);
}
else
{
$procstr = str_replace('$fld_'.$tF,
'0',$procstr);
}
} //cwf mod 20080102
That seems to do the trick.
A.
OK - I think this is solved.
Line 55 in ComputedField.class.php
It does not deal with the fact that the value in a pulldownfield is not the value of the selection so I modified the code as follows:
if ($others[$ref]->GetFieldType() == 'PulldownField') //cwf mod 20080102
{ //cwf mod 20080102
$cwf_sel = $others[$ref]->GetValue()-1; //cwf mod 20080102
$cwf_val = $others[$ref]->GetOptionElement('option_value',
$cwf_sel, $default=""); //cwf mod 20080102
$procstr = str_replace('$fld_'.$tF,$cwf_val,$procstr); //cwf mod 20080102
} //cwf mod 20080102
else //cwf mod 20080102
{ //cwf mod 20080102
if (is_numeric($others[$ref]->GetValue()))
{
$procstr = str_replace('$fld_'.$tF,
$others[$ref]->GetValue(),$procstr);
}
else
{
$procstr = str_replace('$fld_'.$tF,
'0',$procstr);
}
} //cwf mod 20080102
That seems to do the trick.
A.