Huh, i think you dont understand me :))
I dont know how to put onClick event in select tag :) I know how to make
this without zend form, but cant figure it out how to put onClick in
$listOptions array:)
I will use CAPS just to point on some lines :) sorry about that :)
This array build my select tag if i understud well:
$listOptions = array(
'first'=>'first choice',
'second' =>'second choice',
'third' => 'third choice'
)
and then i am building multiselect as:
$lists = new Zend_Form_SubForm();
$lists->addElements(array(
new Zend_Form_Element_Multiselect('nameOfMultiselect',array(
'label' => 'Select all you can apply',
'required' =>true,
'filters' =>array('StringTrim'),
'multiOptions' => $listOptions,
'value' => array('second'), // this one sometimes works and
sometimes not, i cant figure it out why
'onClick' =>'some javascrpt code here',// THIS IS APPLIED
ON SELECT
TAG INSTEAD ON OPTION TAG :))
'validators' => array(
array('InArray', false, array(array_keys($listOptions)))
)
)),
And later this will be displayed as bellow
<select name="lists[nameOfMultiselect][]" id="lists-nameOfMultiselect"
multiple="multiple" onClick="some javascript code here">// there is unwanted
onClick event lol, i want this onClick inside of option tag
<option value="first" label="first choice">first choice</option>
<option value="second" label="second choice">second
choice</option>//THIS ONE SHOULD BE SELECTED, RIGHT? But somehow it is not
:) Well, sometimes it is selected, but not this time :)
<option value="third" label="third choice">third choice</option>// here
i need onClick event :)
Matthew Weier O'Phinney-3 wrote:
>
> -- vladimirn <[EMAIL PROTECTED]> wrote
> (on Tuesday, 26 August 2008, 12:23 PM -0700):
>>
>> Thanks for the link and for guide lines.
>> I thought that something like that should be solution, but i need to
>> rephrase my question-
>> how to add on click in my array? is there somethin like:
>> new Zend_Form_Element_Multiselect('nameOfMultiselect',array(
>> 'label' => 'Select all you can apply',
>> 'required' =>true,
>> 'filters' =>array('StringTrim'),
>> 'multiOptions' => $listOptions,
>> 'value' => array('eml'),
>> 'onClick' => 'DoSomething'// <-------------------
>
> Yep -- any configuration key that does not correspond to an accessor is
> then set as an object property, and passed as an attribute to the view
> helper.
>
>> and more, how to add this on specific array key/value which i am building
>> in
>> $listOptions = array(
>> 'first'=>'first choice',
>> 'second' =>'second choice',
>> 'third' => 'third choice',
>> 'clickOne' => 'I want this one to opena hidden text area :)'
>> );
>
> Again, go to your favorite JS toolkit mailing list or IRC channel. :)
>
>
>> Matthew Weier O'Phinney-3 wrote:
>> >
>> > -- vladimirn <[EMAIL PROTECTED]> wrote
>> > (on Tuesday, 26 August 2008, 11:15 AM -0700):
>> >> Well, is there a room to ask another question? or should i open a new
>> >> topic?
>> >> I need to add hidden text area bellow multiselect, and if you select
>> >> third
>> >> choice, this hidden box should appear visible.
>> >> How to set up something like this?
>> >
>> > Use javascript to do this. When the page renders, do two things:
>> >
>> > * hide the element (set the visibility attribute to 'collapse')
>> >
>> > * connect an event handler to the multiselect option that looks for
>> > the number of selected options and re-displays the hidden element.
>> >
>> > For techniques on this, visit your favorite JS toolkit mailing list or
>> > IRC channel.
>> >
>> >> p.s. [off topic] about zend dojo webinar- can u post a link to my mail
>> or
>> >> here pls?
>> >
>> > Sure:
>> >
>> >
>> >
>> http://www.zend.com/en/company/news/event/webinar-zend-framework-and-dojo-integration
>> >
>> > --
>> > Matthew Weier O'Phinney
>> > Software Architect | [EMAIL PROTECTED]
>> > Zend Framework | http://framework.zend.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19168608.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
> --
> Matthew Weier O'Phinney
> Software Architect | [EMAIL PROTECTED]
> Zend Framework | http://framework.zend.com/
>
>
--
View this message in context:
http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-and-one-more-question-%3A%29-tp19166233p19169726.html
Sent from the Zend Framework mailing list archive at Nabble.com.