Deprecated.
This function will continue to work, but a newer version is available. Use the
add()
function instead.
Creates a new blank item.
The new()
function saves the current item and then creates a new blank
item. When the editing of the new item is complete, you will need to
call another function that will save the new item.
The index of the new item is one after the index of the current item, or zero if there is no current item.
Note that since the new()
function begins by saving the current item,
if the current item cannot be saved for any reason, such as it does not
pass validation, calling the function will cause an error.
Calling new()
on a read-only dataset causes an error.
Note:
A dataset needs to load its data before you call its new()
function.
Usually a dataset finishes loading a short time after the page it is on finishes
loading. So if you call new()
inside the page’s onReady()
event handler, the dataset might not be ready yet.
To call new()
as soon as possible after a page loads, use the dataset's
onReady()
function inside the page’s onReady()
event handler to ensure that both the page and the dataset have finished loading.