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

Question

Question

Forms Collection Change Drop down values

asked on November 22, 2022

I am looking to set the default value of a drop down field (Service Type in my case) to "ENG" based on the selection of the previous drop down field (Active or Contingency in my case).

I have gotten this to work for the first field set in the collection, but cannot get it to work for any others thereafter. Here is my code that works for the first set: 

$(document).ready(function(){
  $('#q90 select').on('change',function(){
    if($('#q90 select').val() == "Contingency") {
	$('#q101 select').val("ENG").change();
	} else {$('#q101 select').val('').change();
    };
  });
})

Does anyone have any ideas?

0 0

Replies

replied on November 22, 2022

You have to account for the fact that the other rows in the collection do not exist when the event handlers are being assigned, which is why it would only work on the first row.

Also, you need to reference the "sibling" dropdown in a different way because the code you currently have doesn't distinguish between the different rows.

The following post might help.

Table and Collection JavaScript Event Handlers - Laserfiche Answers

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.