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

Question

Question

Trigger change on a table

asked on February 24, 2022 Show version history

I am trying to run a function in javascript when some fields change.  I have two function but I am taking the actual functions out of the equation.  I simply cannot get forms to recognize when the first field in a table is changed and I don't understand why.  I am following the jQuery selectors listed in the help file here.

Inside my document ready I have this:

When I change field 14 I get my alert in Chrome:

 

 

When I change the first row of the table I get no alert.

Here is a shot of part of the table

So 35 is the field I want.  I have confirmed through inspection tools that its correct.  Note the table is hardcoded to 1 row - I just want the fields all side by side so there will not be multiple rows of things.

Am I missing something with the selector?  I have tried various other ways, tried (0) instead of (1) and I cant get the form to recognize the change.  Any ideas?

 

Thanks,

Chris

0 0

Replies

replied on February 24, 2022 Show version history

JQuery/JavaScript events for fields within tables and collections get a bit more complicated for a couple of reasons:

  1. Event handlers assigned on document ready only apply to fields that exist when the document first loads
  2. Indexing can be a bit difficult because JQuery selectors don't like parentheses, and if you go that route you need to escape with backslashes like "Field35\\(1\\)"

 

I wrote a post a few years ago that goes into quite a bit of detail about this topic and how delegated handlers provide better options, so hopefully it'll point you in the right direction.

Table and Collection JavaScript Event Handlers - Laserfiche Answers

1 0
replied on February 25, 2022 Show version history

Thanks Jason that's really helpful.  I guess Ill just make the fields outside a table.  We try and stay away from lots of javascript for basic functionality.

The whole point of the function is to do something that still does not seem to work even in forms 11.

1. I have a dropdown list in Forms that has choices in it.

2. I populate the value in that list via a lookup.

3. When I go to change that value the choices are removed from the list.

No matter the setting, no matter the order, no matter the checkbox for append choices, it still doesnt work.  It would be great after all this time if that could be sorted out.

I have a hidden field that holds the lookup return and was going to have javascript set it on the drop down.  I was going to use Forms formula rules but you still can't use formulas on drop down fields either.

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

Sign in to reply to this post.