how to disable some dropdown options ?

AlainR

Member
Hi!
After reading http://fabrikar.com/forums/index.php?threads/eval-options-in-dbjoin.44967/#post-231408 and http://fabrikar.com/forums/index.ph...ble-option-inside-dropdown.45769/#post-236144 I try to disable some options in my dropdown, but it doesn't work.

with Eval populate :
PHP:
...
}else{
  $option=$row->spec_date .' (COMPLET)';
  $row->spec_repr_id='0';
  $opt= JHTML::_('select.option', $row->spec_repr_id, $option);
  $opt->disable = true;//$opt->$options['option.disable']=true;
}
...
or with onload Javascript :
JavaScript:
jQuery("#spec_reserv___spec_repr_id option[value=0]").attr("disabled","disabled");

I tried so many things, I don't remember ma name ;)
So, "my" solution is to disable another field, with onchange Javascript, so customer cannot continue and cannot submit the Fabrik form.

Many thanks in advance for some help.
Best regards.
 
Yes, it's a dropdown element and the code in Eval "construct" the options. And when there are nos more places, option should show but cannot be selected.
 
Hmmm, works for me. My standard test dropdown for the eval'ed option inserts a mixture of normal options, optgroups, and sets one option as disabled:

http://screencast.com/t/HLmxa4DnmExe

Code:
$options[] = JHTML::_('select.option', '<optgroup>', "Group 1");
$options[] = JHTML::_('select.option', '1', 'One');
$options[] = JHTML::_('select.option', '<optgroup>', "Group 2");
$options[] = JHTML::_('select.option', '1', 'Two');
$opt = JHTML::_('select.option', '1', 'Three');
$opt->disable = true;
$options[] = $opt;
return $options;

-- hugh
 
Ah. OK, that's built differently, would require some surgery to the code, refactoring soe stuff, to allow that to work.

-- hugh
 
OK, thanks, I keep as I did : 2 JS code to enable/disable the dropdown if radiobutton's value=0 (as defined in Eval's). It works fine... it works anyway as I wish! :rolleyes:
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top