You are viewing limited content. For full access, please sign in.

Question

Question

Javascript disable certain dropdown options based on a field input

asked on April 10, 2021 Show version history

Am working on a form where the count value populates based on a rule (from a stored proc return) on the Laserfiche form.

If Count = 1

CourseType dropdown shows up with 3 dropdown values (CourseA,CourseB,CourseC) and 1.the user should be able to select only Course C for Count  = 1 and the other 2 courses should be made read only or 

2.the user should be unable to select the other 2 values or

3.i would like to assign Course C for dropdown value and make it readonly so the users cannot change the value if Count = 1(which ever is doable)

I have the script ready where if the Count = 1 the dropdown Type field displays but currently all 3 drop downs are available to select.

#q4 is the dropdown field.

Can i get some help on how i can perform this on the javascript side.

 if ($('#q39 input').val() ==1)
    {
        //alert("Test Prep can submit");
      $('#q4').show(); 
      $('.Submit').show();
       $('#q27').hide();
      $('.Submit').prop("disabled", false);
     
    }

 

0 0

Answer

SELECTED ANSWER
replied on April 12, 2021

I was able to do the 3rd option (assign Course C for dropdown value and make it readonly so the users cannot change the value if Count = 1) with the below js changes.

 

$('#q4 select').val('TestPrep Only');
      $('#q4 select').prop('disabled', true);

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.