StratusForms icon indicating copy to clipboard operation
StratusForms copied to clipboard

One part of form depends on another

Open plbowers opened this issue 5 years ago • 0 comments

So I have a form where in one section the user can set up the options for a select statement in another part of the form. I'm just saving those options in the JSON field. The difficulty is that when loading the data from sharepoint and populating the form there is no way to do something in between the load and the form population.

Specifically the user can set up different foreign currencies (e.g., USD, EUR, etc.) with the appropriate exchange rates and then when entering expenses they can choose the currency that the transaction occurred in. But when loading an empty form from an existing sharepoint item there's no way to (1) get the data from sharepoint, (1.5) update the options for the select statement, and (2) then populate the form with that data setting the currencies as they were saved. (1) and (2) exists but there's no way to do (1.5).

My suggestion is to have an option specifying "onloadfunc" or "ondataloadfunc" or something like that. This function would be called after the data is loaded but before the form is populated. It would have to return a well behaved Deferred object which would then have to be respected in following steps.

plbowers avatar Mar 01 '19 14:03 plbowers