0

I have the following code which is not making much sense.

<td style='width: 233px'><?php 
        if (!empty($jobsprocesscompleteArr)){
                echo CHtml::DropDownList("Jobsprocesscomplete[$i]lookupprocess_id",$jobsprocesscompleteArr[$i]->lookupprocess_id,$processstages,array('id'=>'Jobsprocesscomplete_'.$i.'_lookupprocess_id','style'=>'width:230px','onchange'=>'createjobprocesscomplete('.$item['JOBNO'].',this,'.$i.')'));
            }else{
                echo CHtml::activeHiddenField($jobsprocesscompleteempty,"[$i]JOBNO");
                echo CHtml::DropDownList("Jobsprocesscomplete[$i]lookupprocess_id",0,$processstages,array('id'=>'Jobsprocesscomplete_'.$i.'_lookupprocess_id', 'style'=>'width:230px','onchange'=>'createjobprocesscomplete('.$item['JOBNO'].',this,'.$i.')' ) );
            }
            ?>
        </td>
        <td class=th3>
            <?php 
            if (!empty($jobsprocesscompleteArr)){
                echo CHtml::activeHiddenField($jobsprocesscompleteArr[$i],"[$i]jobsprocesscomplete_id" , array('value'=>$jobsprocesscompleteArr[$i]->jobsprocesscomplete_id) );
                echo CHtml::activeHiddenField($jobsprocesscompleteArr[$i],"[$i]JOBNO",array('value'=>$jobsprocesscompleteArr[$i]->JOBNO, 'id' => "Jobsprocesscomplete_".$i."_JOBNO"));
                //echo CHtml::activeHiddenField($jobsprocesscompleteArr[$i],"[$i]JOBNO",array('value'=>$jobsprocesscompleteArr[$i]->JOBNO, 'id' => "Jobsprocesscomplete_".$i."_JOBNO"));
            }

the drop down list is not being submitted. the oupt of post for mode Jobsprocesscomplete is as follows.

Array ( [0] => Array ( [jobsprocesscomplete_id] => 1 [JOBNO] => 13013059 [datedone] => 2013-10-08 ) [1] => Array ( [jobsprocesscomplete_id] => 3 [JOBNO] => 13013305 [datedone] => 2013-02-19 00:00:00 ) [2] => Array ( [jobsprocesscomplete_id] => 5 [JOBNO] => 13013306 [datedone] => 2013-02-19 00:00:00 ) [3] => Array ( [jobsprocesscomplete_id] => 7 [JOBNO] => 13013307 [datedone] => 2013-02-19 00:00:00 ) [4] => Array ( [jobsprocesscomplete_id] => 9 [JOBNO] => 13013308 [datedone] => 2013-02-19 00:00:00 ) [5] => Array ( [datedone] => ) ) 1

Initially I had the two hidden fields above the dropdownlist within the if statement, but were not appearing in post. when i moved them to the below td it appears in post however I cannot move the drop down list and the dropdownlist is not appearing in post. what am i doing wrong?

HTML

The following is the drop down list that does not get passed to form under $_POSTS['Jobsprocessco mplete']

<td style="width: 233px">
<select id="Jobsprocesscomplete_0_lookupprocess_id" name="Jobsprocesscomplete[0]lookupprocess_id" onchange="createjobprocesscomplete(13022020,this,0)" style="width:230px">
<option value="533">25 NA</option>
<option value="13059">35 1st Pass Velocity Analysis</option>
<option value="13061">75 3rd Pass Velocity Analysis</option>
<option value="13063">100 DBS</option>
<option selected="selected" value="0">Select</option>
</select>
</td>

I had to input a hidden field and use onchange event to populate to pass it into post

<td class="th3">
<input id="hidden_Jobsprocesscomplete_0_lookupprocess_id" type="hidden" name="Jobsprocesscomplete[0][lookupprocess_id]">
<input id="Jobsprocesscomplete_0_JOBNO" type="hidden" name="Jobsprocesscomplete[0][JOBNO]" value="13022020">
<input id="Jobsprocesscomplete_0_datedone" class="hasDatepicker" type="text" name="Jobsprocesscomplete[0][datedone]" style="width:80px;">
</td>
4

1 回答 1

1

I think the name of the dropdown should be Jobsprocesscomplete[$i][lookupprocess_id] since you are doing arrays. And that value should get stored to $_POST['Jobsprocesscomplete'][0]['lookupprocess_id']

于 2013-10-09T12:54:54.847 回答