Drop down menu defaults [SOLVED]

Archived from the Xataface Users forum.

cantlep — Tue May 25, 2010 4:05 am

Hiya,

I have some drop down menus where data is populated from a valuelist. Is there anyway to have the select menu display one of those values (instead of “Please Select”) as the first option?

Thanks

Paul


shannah — Tue May 25, 2010 8:30 am

Use the fieldname__default() method in the delegate class to specify a default value for your field:

Code: Select all
function myfield__default(){     return 'foo'; }

(Note that in the case where the field stores an int but you’re using a valuelist to display a different label, then you should return an int from this method and not the string that is associated with it).

_Steve


cantlep — Tue May 25, 2010 8:35 am

Awesome! You really have thought of everything.

Thanks very much as always

Paul