# How do I let the user create a new record?

**URL:** <https://forum.servoy.com/t/how-do-i-let-the-user-create-a-new-record/9883>\
**Category:** Classic Servoy\
**Created:** [November 14, 2008, 4:47pm UTC](https://forum.servoy.com/t/how-do-i-let-the-user-create-a-new-record/9883 "2008-11-14T16:47:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![birgit](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@birgit](https://forum.servoy.com/u/birgit)\
**Post date:** [November 14, 2008, 4:47pm UTC](https://forum.servoy.com/t/how-do-i-let-the-user-create-a-new-record/9883/1 "2008-11-14T16:47:38Z")

</div>

Hi

The question looks so simple. But however I implement it, I run into a dead-end.  
Here is what I currently do and what my problem is:

- I set auto save off

- I open a dialog on a new record

- I let the user enter data

- the user either cancels the dialog or commits it

- if the user cancels the dialog: I delete the record, close the dialog and turn auto save on

- if the user commits the dialog: I save the record

- if save fails this is either because of onRecordInsert which returns false or because of a database error when e.g. not null attributes are not filled. But I do not get into the solution error handler where I get an exception and a reason for the error.

[/list:u]  
[/list:u]  
With auto save on I run into the solution error handler whenever I clicked outside of a field (via recordEditStop?). The error handler was ok but it was not ok that the user could commit the changes without using the save button. So I turned auto save off. But databaseManager.saveData() does somehow call other code than recordEditStop does, since I do no longer run into solution error handler. Puh!

Any suggestions? Regards  
Birgit

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [November 14, 2008, 6:19pm UTC](https://forum.servoy.com/t/how-do-i-let-the-user-create-a-new-record/9883/2 "2008-11-14T18:19:55Z")

</div>

> birgit:
> 
> 1. if the user cancels the dialog: I delete the record, close the dialog and turn auto save on

I’m not sure to understand it completely but this is wrong, you don’t have to delete the record because the record has not been yet saved, just use databaseManager.rollbackEditedRecords().  
At least it’s a starting point ![:)]( "Smile")

---

<div class="post-metadata">

**Author:** ![birgit](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@birgit](https://forum.servoy.com/u/birgit)\
**Post date:** [November 14, 2008, 9:13pm UTC](https://forum.servoy.com/t/how-do-i-let-the-user-create-a-new-record/9883/3 "2008-11-14T21:13:57Z")

</div>

Thank you! I’ll try this. Any starting point is very welcome.

I wonder how others solve this “simple” problem?

Best regards

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [November 15, 2008, 8:23am UTC](https://forum.servoy.com/t/how-do-i-let-the-user-create-a-new-record/9883/4 "2008-11-15T08:23:22Z")

</div>

I do what nicola suggested.

---

<div class="post-metadata">

**Author:** ![birgit](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@birgit](https://forum.servoy.com/u/birgit)\
**Post date:** [November 17, 2008, 3:08pm UTC](https://forum.servoy.com/t/how-do-i-let-the-user-create-a-new-record/9883/5 "2008-11-17T15:08:16Z")

</div>

Does this mean:

- set auto save to false
- open dialog on new record
- rollback transaction onHide form
- validate user input when user clicks OK and commit transaction if validation is ok  
???

Does anybody use auto save on when creating new records with a dialog?  
Does anybody catch solution error for validation when creating new records?

Thank you and regards  
Birgit
