[ask]how to add class in selection (simbio_form_element.inc)

Feels free to drop any suggestions of what should be put in to the next release of SLiMS.

Moderators: wynerst, buitenzorg812, purwoko, sutriadi, ido, Dicarve, ridorido

Post Reply
User avatar
jushadi
Posts: 35
Joined: 27 Sep 2011, 16:29
Location: Makassar
Contact:

[ask]how to add class in selection (simbio_form_element.inc)

Post by jushadi » 06 Apr 2013, 05:44

./simbio2/simbio_GUI\form_maker/simbio_form_element.inc.php
[ask]how to add class in selection (simbio_form_element.inc)[question mark] :?:
if I make it like this

Code: Select all

$_buffer .= '<option value="'.$option[0].'" '.(($option[0] == $this->element_value)?'selected':'').' class="hadi'">'; 
I get class="hadi" for every selection list, but I want make it with selection option for array

for instance

Code: Select all

$mtype_options[] = array($mtype_data[0], $mtype_data[1]);
$form->addSelectList('memberTypeID', __('Membership Type').'*', $mtype_options, $rec_d['member_type_id']);
I want to make the third parameter in that array so it may look like this

Code: Select all

$mtype_options[] = array($mtype_data[0], $mtype_data[1],  $mtype_data[2]);
or like this

Code: Select all

$mtype_options[] = array('selection_value', 'selection_option', 'selection_class');
I get class for my selection with this code :oops:

Code: Select all

$_buffer .= '<option value="'.$option[0].'" '.(($option[0] == $this->element_value)?'selected':'').' class="'.$option[2].'">';
then initialize array option in form :arrow:

Code: Select all

$options[] = array('1', 'Mahasiswa', 'jus');
$options[] = array('2', 'Dosen', 'hadi');
$options[] = array('3', 'Pelajar', 'arman');
result : 8-)

Code: Select all

<select id="memberTypeID" name="memberTypeID">
<option class="jus" value="1">Mahasiswa</option>
<option class="hadi" value="2">Dosen</option>
<option class="arman" value="3">Pelajar</option>
</select>
but with this annoying errror : :?

Code: Select all

Notice: Undefined offset: 2 in simbio2/simbio_GUI/form_maker/simbio_form_element.inc.php on line 122
how to define array $option so it just not limit with 2 dimensional array, as default $option[0], and $option[1] working fine, but I get error undefined when I add the third parameter in array when initializing form with selection element, so $option[2] recognized as the third parameter, or is there any other way around to do this?
Read!

User avatar
hqm
Posts: 21
Joined: 26 Mar 2013, 19:17

Re: [ask]how to add class in selection (simbio_form_element.

Post by hqm » 07 Apr 2013, 15:47

kalo pake array_fill / array_fill_key untuk pada saat inisialisasi?

*ini ceritanya mau ngapain sih mas? :D

User avatar
jushadi
Posts: 35
Joined: 27 Sep 2011, 16:29
Location: Makassar
Contact:

Re: [ask]how to add class in selection (simbio_form_element.

Post by jushadi » 08 Apr 2013, 10:10

mau pakai plugin chain jquery, select list kedua harus memiliki kelas berbeda berdasarkan value pada select list pertama, solved tapi bukan pakai plugin chain
Read!

User avatar
hqm
Posts: 21
Joined: 26 Mar 2013, 19:17

Re: [ask]how to add class in selection (simbio_form_element.

Post by hqm » 11 Apr 2013, 16:39

jushadi wrote:mau pakai plugin chain jquery, select list kedua harus memiliki kelas berbeda berdasarkan value pada select list pertama, solved tapi bukan pakai plugin chain
ooo pake apa pak? kali aja bisa dishare , buat belajar yang laen :D

User avatar
jushadi
Posts: 35
Joined: 27 Sep 2011, 16:29
Location: Makassar
Contact:

Re: [ask]how to add class in selection (simbio_form_element.

Post by jushadi » 12 Apr 2013, 11:14

sekarang balik pakai chained jquery plugin lagi udah bisa, status solved
Read!

Annu
Posts: 36
Joined: 12 Oct 2012, 14:38
Location: Islamabad
Contact:

Re: [ask]how to add class in selection (simbio_form_element.

Post by Annu » 18 Apr 2013, 11:42

thanks jushadi for your help and kind consideration to make this possible

Post Reply