Best method for setting default text on select elements in editor?

Best method for setting default text on select elements in editor?

johnmc0831johnmc0831 Posts: 3Questions: 1Answers: 0

I'm current setting the options for my select boxes in the editor using ipOpts:

{
     label: "Location:",
     name: "LocationID",
     type: 'select',
     ipOpts: getLocations()
 }

This works just fine. What I'm looking to do is to set the default text to "- Please Select -" in the select itself. I've tried using the 'def:' options but to no avail. Before I stack hacking with jQuery, any advice on how best to do this?

Answers

  • johnmc0831johnmc0831 Posts: 3Questions: 1Answers: 0

    Scratch that...figgered it out. You need to pass the value to the def: option, not the text. Duh.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi,

    Heh - good to hear you got it sorted out :-).

    One thing - if your getLocations() method is currently using Sjax (i.e. $.ajax with async: false) you could use the update() method for the select field type which could potentially speed things up. Not sure what getLocations() is currently doing, but mention it just in case it might be useful!

    Regards,
    Allan

  • johnmc0831johnmc0831 Posts: 3Questions: 1Answers: 0

    Good guess...it's indeed making an AJAX call. I will try the update() method...

This discussion has been closed.