Form Builder - calculated fields and Checkboxes

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
andym
Forum Members
Forum Members
Posts: 31
Joined: Mon Dec 24, 2007 9:00 pm

Form Builder - calculated fields and Checkboxes

Post by andym »

Hi,

Although I specified a value against the options for the checkbox the html created is still reflecting the "t" result as the selected value - not what I specified.

Unfortunately this is also seems to be the value that the computed fields see, though the result stored in the database is actually the one I specified.

I haven't tracked down the problem yet - I just worked around it - but when I have some time I think I might do that.

A.
chrisl
Forum Members
Forum Members
Posts: 57
Joined: Fri Dec 30, 2005 10:08 am
Location: London

Re: Form Builder - calculated fields and Checkboxes

Post by chrisl »

Yes,  clever as the FormBuilder module is (thank you Samuel Goldstein and others), I have found it needs some small alterations to make it work as required.

To take your example, when you specify values in the checkbox options fields they are saved in the "***_field_opt" database.  So to retrieve them for the ComputedField.class you could try changing the three cases of 

$others[$ref]->GetValue()
to
$others[$ref]->GetHumanReadableValue()
in the compute function of ComputedField.class.php.

This should work for both string and numeric input and also does not depend on using the *Store Results in Database field type. 
The HTML source view will still show the checkbox value="t" if no changes have been made to the GetFieldInput function of CheckboxField .class

NOT tested and not sure of other implications but works for me so far.
andym
Forum Members
Forum Members
Posts: 31
Joined: Mon Dec 24, 2007 9:00 pm

Re: Form Builder - calculated fields and Checkboxes

Post by andym »

Thanks for that.

I have moved on to something else, but when I get back to this I'll give your suggestion a try.

A.
Post Reply

Return to “Developers Discussion”