How to Use Validation with a New Record & AutoSave

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

How to Use Validation with a New Record & AutoSave

Postby john1598360627 » Sat Dec 03, 2022 1:27 am

I want to implement a 'New Record' process to my project.

However, this conflicts with various handy features that Servoy provides.


FEATURES
Validation - I have setup validation for corresponding databases and dataproviders. Such that errors are prevented. Such as, having blank values. I then run a 'save revert' to prevent these values from being put onto a record.

AutoSave - In conjunction with validation. Since validation is run on save, if a record fails validation then the record isn't saved despite AutoSave being on thanks to 'save revert'.


However, I encountered some issues with this setup with regards to a new record.

NEW RECORD
A New Record is created entirely blank. And with AutoSave on, this means if you try to edit the record it will freak out due to having so many 'errors' initially.

Thus I created a process that goes like this;

1. Disable Autosave
2. Create New Record
3. (User edits the new blank record)
4. (User does manual save)

After the manual save, autosave is turned back on. This process is to let the user initialize the record by themself. And with the manual save, if they input something wrong the new record won't be jolted back into Autosave mode just yet.

This process makes the most sense to me. However, once I implemented this. I got a bug? Despite having autosave disabled, seemingly for some reason the validation goes off still. Which is good... But the strangest aspect is that when the LAST dataprovider required to be added is left... it will not validate it. It will stay unvalidated despite the data fulfilling the validation. When I try to manually save it still fails. It's like it's getting itself stuck.

QUESTIONS
What is going on with the issue I'm having?

What is the CORRECT way of implementing a new record creation with validation that could conflict with a fresh new record?
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to Use Validation with a New Record & AutoSave

Postby sean » Sat Dec 10, 2022 12:36 am

Hi John,

What are you using for your validation? Just column properties?

Here are a couple of webinars that might help:
Saving Data - This is and old video, but shows a good breakdown of how saving data can work different ways in Servoy.

2020.12 Release Video - About halfway through, it shows updated practices for doing validation and hooking it to the UI

Hope this helps.

Best,
Sean
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: How to Use Validation with a New Record & AutoSave

Postby john1598360627 » Sat Dec 10, 2022 1:30 am

sean wrote:Hi John,

What are you using for your validation? Just column properties?

Here are a couple of webinars that might help:
Saving Data - This is and old video, but shows a good breakdown of how saving data can work different ways in Servoy.

2020.12 Release Video - About halfway through, it shows updated practices for doing validation and hooking it to the UI

Hope this helps.

Best,
Sean


Thank you when I have a chance I will watch these!


What I realized was, the issue wasn't validation. I set the validation flags to be 'warning' so any errors wouldn't stop saving.

However, the realization was the problem was how created new records. It seems like null variables were being set, causing Servoy itself to block the record from being shown. After setting all the values of the record to blank that seems to help stop the problem. Or that's what I assume. This is most likely the result of me not doing the proper way of creating a new record previously though.
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 6 guests