Page 1 of 1

Form Builder - Pulldown fields

Posted: Sat Dec 29, 2007 10:55 am
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.

Re: Form Builder - Pulldown fields

Posted: Tue Jan 01, 2008 5:26 pm
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.