Is it possible to use the same form for inserting data and updating data?
I have always built two forms, just wondering if I can cut down on my code/time.
Is it possible to use the same form for inserting data and updating data?
I have always built two forms, just wondering if I can cut down on my code/time.
Yes, you only need one form then in the Server Connect you find out if it needs to update or insert.
In the form I have a hidden field that has the ID of the data being manipulated from the Server Connect. If server side detects an ID it means a record already exists, so the DB is updated, otherwise an insert is carried out.
On the front end, populate the form with the record info that is required. If there are no DB records for it the fields will be blank anyway.
This should help:
Thanks Tom, now that I know it’s possible, I will spend some time today seeing if I can figure it out.
Much appreciated.
This is how I handle it in the Server Connect API. If the hidden “ContactId” field on my form was populated on submit, then the condition will evaluate true and it’ll perform an update, otherwise it performs an insert.