On click event checking

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

azaleas
Ebase User
Posts: 81
Joined: Thu Jul 30, 2015 12:44 pm

On click event checking

#1

Postby azaleas » Wed Aug 05, 2015 11:22 am

Hi,
I have two buttons on the form and I need to check if the first button was clicked. I click to the second button and first it should check if the first button was clicked, i.e. the data was submitted. If no, give an error message and stop execution. How can I achieve this via JS?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Wed Aug 05, 2015 12:43 pm

Presumably various fields are changed when your first button is clicked. You can test if a field has a non null value like this:

Code: Select all

if (fields.FIELD1.value)
  ..do something
You could also get the script run by the first button to explicitly set a boolean field to show it's been clicked:

Code: Select all

fields.BUT1_CLICKED.value = true;
Then check this in the script for the second button (in this case it checks for a non null value of "true"):

Code: Select all

if (fields.BUT1_CLICKED.value)
 ..do something
0 x


Who is online

Users browsing this forum: No registered users and 9 guests