<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Arial">I'm using the Nice Menus module, and
I would like to be able to have more than the 10 menus allowed by the
module.&nbsp; This limit is set by a hardcoded select list on the admin
settings page for the module.&nbsp; I want to modify the form by changing
the select list to a text field so that an arbitrary number of menus
can be selected.&nbsp; To do this, I'm using hook_form_alter() to modify the
nice_menus_number field in the nice_menus_admin_settings form.&nbsp; First
here is the form code in the module<br>
<br>
/**<br>
&nbsp;* Settings form as implemented by hook_menu<br>
&nbsp;*/<br>
function nice_menus_admin_settings() {<br>
&nbsp; $form['nice_menus_number'] = array(<br>
&nbsp;&nbsp;&nbsp; '#type' =&gt; 'select',<br>
&nbsp;&nbsp;&nbsp; '#title' =&gt; t('Number of Nice Menus'),<br>
&nbsp;&nbsp;&nbsp; '#description' =&gt; t('The total number of independent nice menus
(blocks) you want.'),<br>
&nbsp;&nbsp;&nbsp; '#default_value' =&gt; variable_get('nice_menus_number', '2'),<br>
&nbsp;&nbsp;&nbsp; '#options' =&gt; drupal_map_assoc(array(0, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10)),<br>
&nbsp; );<br>
<br>
&nbsp; return system_settings_form($form);<br>
}<br>
<br>
and here is my form alter function:<br>
<br>
function cwl_form_alter($form_id, &amp;$form) {<br>
&nbsp; switch ($form_id) {<br>
&nbsp;&nbsp;&nbsp; &nbsp; case 'nice_menus_admin_settings':<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $form['nice_menus_number']['#type'] = 'textfield';<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $form['nice_menus_number']['#size'] = 2;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
</font></font><br>
<font size="-1"><font face="Arial">This works in that it changes the
field type to a text field, and the value attribute is the value in the
nice_menus_number variable.&nbsp; This works fine as long as I select a
value of 10 or less.&nbsp; However, if I select a value higher than 10, I
get an error that says "</font></font>
<font face="Arial">An illegal choice has been detected. Please contact
the site administrator</font>."<br>
<br>
But, if I change my function to also use a select list, like this:<br>
<br>
function cwl_form_alter($form_id, &amp;$form) {<br>
&nbsp; switch ($form_id) {<br>
&nbsp;&nbsp;&nbsp; &nbsp; case 'nice_menus_admin_settings':<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $form['nice_menus_number']['#options'] =
drupal_map_assoc(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
<font face="Arial">it works fine, and I can select a value higher than
10.&nbsp; Since it's using the default system_settings_form() function,
there isn't a maximum value set somewhere.&nbsp; Plus, the default value is
being set correctly when the form is initially displayed.&nbsp; Can anybody
explain why a select list works, but a text field doesn't?<br>
<br>
Thanks.<br>
<br>
Steve</font><br>
</body>
</html>