Hello Mr. , Ihope you are fine
I'm using nested template field type as follow
$fields["new_question"] = array(
'display_label' => TRUE,
'type' => 'template',
'label' => lang('new-question'),
'fields' => array(
'question_en' => array('label'=>lang('question-en') , 'required'=>TRUE),
'question_ar' => array('label'=>lang('question-ar'), 'required'=>TRUE),
'question_type' => array('type'=>'enum' , "mode"=>"radios" , "options"=> array("text"=>lang("text") , "multiple_choice"=>lang("multiple-choice")) , 'label'=>lang('question-type')),
'choices' => array('type'=>'template',
'label'=> lang('question-choices'),
'display_label'=> TRUE,
'fields'=> array(
'choice_en' => array('label'=> lang('choice-en')),
'choice_ar' => array('label'=> lang('choice-ar'))
),
'add_extra' => TRUE,
'repeatable' => TRUE
)
),
'add_extra' => TRUE,
'repeatable' => TRUE
);
when I add another , the nested template still see that this is the first parent template , HTML output is
input type="text" name="new_question[0][choices][0][choice_en]" value="" id="new_question_0_choices_0_choice_en" class="field_type_text field_depth_1 field_depth_0" size="40" data-orig_name="new_question[0][choices]" data-index="0" data-key="choice_en" data-field_name="new_question"
new_question[0] it is always 0 even I make "add another"
Problem exist only in nested template not in the original template
do I make anything wrong?
Thanks in advance
Comments