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

Question

Question

Save data in real-time

asked on November 27, 2018

Hi all,

 

I'm trying to make a reservation's form with a table.

My rows are fill using a database.

In my table, I created a checkbox.

If my checkbox is checked, that means the person is present. By default, all checkbox is not checked.

 

 

As soon as a user come, I check the box.

I want to save this information in my database at this same moment.

 

My idea was to execute a javascript function.

When the user check a box (check or uncheck), he run the javascript to save the form then, in the processus, it execute a workflow to update the database then back to the form.

 

This could be working but this way is too slow.

Is it possible to directly update the database from the Form?

 

Thanks in advance.

Regards

 

0 0

Replies

replied on November 27, 2018 Show version history

There aren't any Forms native tools to do what you are looking for. I can see writing a standalone API app that can push data into the database. Then you could use JavaScript to do an AJAX request. It's kind of bypassing a lot of Forms and Workflow mechanisms though, and possibly not for the better.

1 0
replied on November 27, 2018

Hi Devin,

Thank you for your return.

 

Do you have template?

Thanks in advance.

Regards

0 0
replied on November 27, 2018 Show version history

This can also be done with a stored procedure that takes the input values and inserts them into the database, but, it can be pretty complicated so you'll want to do a lot of testing. 

I did the following:

  • Forms
    • Added hidden fields to store the input values
    • Set a lookup rule that plugged the values into the stored procedure
    • Disabled the automatic execution so it only runs when the "autofill" button click event is triggered
    • Set JavaScript events to plug the desired values into the lookup fields, triggers the autofill click event, then clears the fields
  • SQL Stored Procedure
    • Receives multiple inputs, sanitizes them, and moves them into placeholder variables
    • Has an IF condition to make sure it only performs updates under specific conditions (i.e., no blank values)
    • Inserts the data into the desired table/row
    • Returns a bit (true/false) result (default set to false, changed to true under the IF condition
1 0
replied on November 27, 2018

@████████probably has the simpler solution. I spin up API's all the time, so it's easier for me, but stored procedures might be easier in other environments.

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

Sign in to reply to this post.