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

Question

Question

Using javascript events in a collection with modern designer

asked on January 29 Show version history

I'm learning to write JavaScript in the modern Forms designer.

I have a collection with two drop-down controls for grade and school. When a user selects a grade, I want to set the school dropdown to list the schools that offer that grade. For example, if the user selects grade 6, the school dropdown should be populated with all the schools that offer grade 6.

I've created an event handler and called it using subscribe and using onFieldChange. That worked in that the handler got called when expected. Unfortunately, I wasn't able to determine in the handler, which instance of the grade control had been changed. I found the argument that got passed to the handler, but that didn't help. The argument includes a variable named "Index", but it is set to null.

Is what I'm trying to do possible? If so, I'd love to get ideas on how to do it.

Thank you!

0 0

Answer

SELECTED ANSWER
replied on January 29

Hi Tim!

To be honest, I haven't really used scripting with tables or collections in the new Designer. Originally, they didn't support interacting with those elements, but I think it's gotten a little better.

But for what you describe, I would see if I could get it into a data lookup rather than scripting. Assuming the grades a school covers are contiguous, you could have one column for minimum grade and another for maximum. Then for the lookup use a stored procedure that queries all schools that cover the selected grade.

1 0

Replies

replied on January 30

Hi Tim,

I would agree with Pieter.

What you are looking to do can be done with data lookups.

I did a quick test in Forms using Laserfiche Cloud using the following data as a baseline in a data management table:

Configured a Form with a lookup to the data management table and 2 rules: 1 Select rule for the list of grades and 1 Select rule for the School(s) that matches the grade selected.

Good Luck!

3 0
replied on January 30

Thanks, guys, that lookup idea sounds like a great thing to try. Pieter, I've never tried a lookup with a SP, and didn't even know you could do that. Definitely something I need to take time to learn about.

Thanks again!

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

Sign in to reply to this post.