We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How to add "onChange" in select box? | Forum

Guna
Guna Dec 25 '14
Normally we can add "onChange" to select box like below.


  <select name="maincourse" onchange="firstStep(this)">


In plugin,


$select_box_array = array('2014-15'=>'2014-15', '2015-16'=>'2015-16', '2016-17'=>'2016-17');


$selectboxentry = new Selectbox('select_box');


$selectboxentry->setRequired();$selectboxentry->setLabel($this->text('plugin1','language1'));


foreach($select_box_array as $sba=>$sb)

{

   $selectboxentry->addOption($sba , $sb);

}


$enquiry_payment_form->addElement($selectboxentry);


How to add "onChange" to select box statement?

The Forum post is edited by Guna Dec 25 '14
lattinaD
lattinaD Jan 6 '15
You add onchange action in the onchange attribute of {input} tag in html file
Guna
Guna Jan 6 '15
In .html file we have syntax like this. Can you please provide an example with below code?


{input name='year'}{error name='year'}

Daisy Team
Daisy Jan 20 '15
Guna, please check out our crash course: https://docs.oxwall.org/dev:crash-course#using-forms

Or download our new Plugin Skeleton plugin to see how to develop the forms with the select type fields. Here is URL to the Store item: http://www.oxwall.org/store/item/695