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

Question

Question

how to test if the form is being redrawn

asked on July 25, 2016

Hi all,

I have some javascript which run quite happily when a form is being used but as it's redrawn before being sent to Laserfiche (I'm using a javascript-free form to save to Laserfiche), the redraw is running into javascript which is preventing a save.

So I figure I have two options:

1. figure out which code is causing the issue and make my code more Forms-friendly

or

2. ask if there's a session variable or cookie I can read and use an if(){} statement to disable to javascript from running when a form is being redrawn.

 

Clearly option 2 is way more appealing. Also, more interesting as it means learning something new about Forms.

Has anyone got knowledge of how I can test for a form being redrawn?

-Ben

 

0 0

Answer

SELECTED ANSWER
replied on July 25, 2016 Show version history

Yeah, it is frustrating that Forms does not let you specify which code to run while the form is being used and which code to run when it is being saved.

To get around it, we use checks like this:

$("#Field1").is("div")

This will output true if the form is being saved, and false if not (since Field1 will be input, textarea, etc. while being filled by a user). So you can put it inside an if statement to have your code run conditionally.

0 0

Replies

replied on July 25, 2016

Thanks Ege,

That's very helpful.

-Ben

 

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

Sign in to reply to this post.