CreateInputDropdown: Value difference from Selection

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
musicscore
Power Poster
Power Poster
Posts: 477
Joined: Wed Jan 25, 2006 11:53 am
Location: Netherlands

CreateInputDropdown: Value difference from Selection

Post by musicscore »

I try to make a dropdown, but the text in the selection should be different from the value.

Code: Select all

<select name="1enddate_Month">
<option label="January" value="01">January</option>
<option label="February" value="02">February</option>
<option label="March" value="03">March</option>
<option label="April" value="04">April</option>
<option label="May" value="05">May</option>
<option label="June" value="06">June</option>

<option label="July" value="07">July</option>
<option label="August" value="08">August</option>
<option label="September" value="09">September</option>
<option label="October" value="10">October</option>
<option label="November" value="11">November</option>
<option label="December" value="12" selected="selected">December</option>
</select>
I looked in the Api documentation but could not find the solution.
Can someone help please.

I tryed :

Code: Select all

$this->smarty->assign('input_month', $this->CreateInputDropdown($id, 'item_month', $month_list, '-1', '$month_number'));
The value is always the name of the month ($month_list = array) but should be the number.

Please help.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CreateInputDropdown: Value difference from Selection

Post by calguy1000 »

The CreateInputDropdown function has always been 'backwards'.

i.e:

Code: Select all

$data = array('January'=>'01','February'=>'02' ...);
$smarty->assign('monthdropdown',
   $this->CreateInputDropdown($id,'month',$data,-1,$the_month);
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
musicscore
Power Poster
Power Poster
Posts: 477
Joined: Wed Jan 25, 2006 11:53 am
Location: Netherlands

Re: CreateInputDropdown: Value difference from Selection

Post by musicscore »

Calguy,

Thanks. With your help I did it.
I'm writing my first module and sometimes I need some help.
CMS Made Simple community is very helpfull. That's the most powerfull thing about CMSMS. Many people can write php scripts but only the best are willing to help others.
Post Reply

Return to “Developers Discussion”