0

hi i have 2 combo boxes 1) profile and 2) centre and i am setting the value of 1 based on that selected in the 1st. on change of 1st, correct value is displaying in the 2nd, but the no value is getting posted for the 2nd combo in the form.

please let me know where im going wrong. Here is what i have done:

    var centre=document.getElementById('centre');
if(profile==1)//super admin
 {
 centre.value="AD";
 centre.disabled=true;       

 }
 else 
 {

  centre.value="";
  centre.disabled=false;
 }

I am using codeigniter here so my view is :

    <td><?php echo form_label('Profile','profile'); ?></td>
    <td><?php echo form_dropdown('profile', $profilecombodata,set_value('profile'),$js); ?></td>
    <td style="color: red;"><?php echo form_error('profile'); ?><?php echo isset($errors['profile'])?$errors['profile']:''; ?></td>
</tr>
<?php $js ='id="centre"  onChange="change_profile(this.value);" ';

?>
<tr >
    <td><?php echo form_label('Centre','centre'); ?></td>
    <td><?php echo form_dropdown('centre', $centrecombodata,set_value('centre'),$js); ?></td>
    <td style="color: red;"><?php echo form_error('centre'); ?><?php echo isset($errors['centre'])?$errors['centre']:''; ?></td>
</tr> 
2
  • What is your profile here...?? Commented Apr 26, 2013 at 7:16
  • profile i am sending while calling the function. it is the 1st combo selected value. that value is proper. Commented Apr 26, 2013 at 7:20

1 Answer 1

1

Disabled fields doesn't get posted with HTTP. You need to make them readonly or Hidden.

Else you need to use javascript or Jquery to send Ajax request.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the info :) used hidden for that combo :)
Great to know that it helped :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.