javascript - Disabling or enabling a button depending on checkboxes oracle apex -


i have report checkboxes in each row , 1 submit button. want disable button when checkboxes unchecked. button should enabled when @ least 1 checkbox checked on report. tried creating dynamic action of type enable/disable. when no checkboxes checked button disabled when there @ least 1 check, button still disabled. tried javascript to couldnt accomplish because of poor js knowledge. codes tried below:

$("input[type='submit']").prop('disabled',true); if ( $(this.triggeringelement).is(':checked') )     $("input[type='submit']").prop('disabled',true); 

///

if ($('input[type='checkbox']:checked').length > 0 && $("input[type='submit']").is(':disabled')) {     $("input[type='submit']").removeattr('disabled') } else if ($('input[type='checkbox']:checked').length == 0) {     $("input[type='submit']").attr('disabled', true) } 

query of report:

select  apex_item.checkbox2(1,urun.barkod, 'class=indcheck') "select", u.ad, ma.ad magaza_adi, fiyat, apex_item.select_list(         p_idx           =>   2,         p_list_values   =>   '1;1,2;2,3;3,4;4,5;5,6;6,7;7,8;8,9;9,10;10',         p_show_null     =>   'yes',         p_null_value    =>   null,         p_null_text     =>   '-0-',         p_item_id       =>   'indselect') "adet" urunsatis urun, uye un, adres ad, anlasmalar an, magaza ma, urun u un.username = :session_user_name , un.id = ad.uye_id , ad.apartman_id = an.apartman_id , an.magaza_id = urun.magaza_id , ma.id = urun.magaza_id , u.barkod=urun.barkod order 1; 

you need static id button better identify using javascript - example button1.

now, create dynamic action.

event: change

selection type: jquery selector

jquery selector: input.indcheck

this trigger dymanic action whenever 1 of checkboxes clicked. action of dynamic action, choose execute javascript code , use following code:

if ($(".indcheck:checked").length == 0) {     $("#button1").addclass("apex_disabled"); } else {     $("#button1").removeclass("apex_disabled"); } 

this count checked checkboxes. in case amount zero, deactivate button. if amount @ least one, activate button. careful static id of button, needs match.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -