Form Builder - Pulldown fields

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 - Pulldown fields

Post by andym »

Hi,

Just a bit of input in case it is of interest.

I wanted to actually select the first value in my list rather than add one to the front of the list resulting in [unspecified] if the field was not changed.  That is, I wanted a default value.

So in the file PulldownField.class.php (under modules\formbuilder\classes) at line 113 I made the following change:

// $sorted = array(' '.$this->GetOption('select_one','')=>'') + $sorted;
$this->Value = ''; //cwf mod 20071229

This seems to do the trick.

I guess it could be made more controllable in case different behaviour is needed elsewhere, but this suited me.

A.
andym
Forum Members
Forum Members
Posts: 31
Joined: Mon Dec 24, 2007 9:00 pm

Re: Form Builder - Pulldown fields

Post by andym »

Further to my previous note:

I changed it so that the value used is actually $this->Value and defined a variable indexSelected to pass rather than the -1.  That way when there is an error in submission the form is re-displayed with previously selected values retained.

A.
Post Reply

Return to “Developers Discussion”