add a start option for dynamic drop down list

add a start option for dynamic drop down list

hanyelbanahanyelbana Posts: 24Questions: 0Answers: 0
edited August 2013 in Editor
Hi,

I need to add a start option with null value to generated dropdown list like ( Please select country from the list ...)

editor.field('country_id').update( json.countries );

That will be good for validation and sometimes I need to let user to select null.

How can I add this option from the client code not from the database.

Thanks

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    You can't really add a `null` option, but you can add an empty string which might be okay for you? You can't add `null` specifically since HTML / HTTP don't understand Javascript null.

    [code]
    json.countries.unshift( {
    label: 'Please select country from the list...',
    value: ''
    } );
    [/code]

    Just before you call the update function.

    Regards,
    Allan
This discussion has been closed.