I have added an extra option to activeDropDownList by adding an an array into the $htmlOptions like the following
array('prompt'=>'None')
However, as the document states, this will leave the value as empty. I need this value to be set to '0'.
This should be done using 'options' instead of 'prompt' but when trying this way the None field is no longer present in the list at all. Following is the code I am using.
Thanks again for the reply qiang but the documentation does not state that 'insert' is a valid value to put here. I did try it but it did not fix the problem.
murugan,
Your suggestions is how I initially had it but that method does not let me specify a value for None.
i think qiang ment to insert the 'prompt' option in your normal list of options on first place before you use them as a parameter for activeDropDownList…
I just realised that I need to explain this a little better. The value needs to be passed as an integer, not a string.
I need to option to print as follows:
<option value="0">None</option>
The important part here is not the 'None' but the value being an integer of zero. As stated in the documentation the prompt $htmlOptions leaves the value empty.
By using prompt for the $htmlOptions I am left with
This post wasn’t as resolved as I thought. array_merge() will actually reset the array indexes to 0,1,2,3 etc. rather than keep the table id as required. Therefore the code should be changed as: