O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inserting records

We've learned how to create a local database and a table associated to it. The next logical step will be to insert records in our recent table. For our new goal, we're going to use a simple form where a user can type the values for our fields. Traditional web applications are using the same method. Obviously, our form will contain a button for doing the action.

You can insert records as you desire, but remember the database has size restrictions. We set this value through a parameter passed in the function, which opens or creates our database. The form introduced in this recipe allows you to save many records and the application will display a simple alert box after each insertion.

The code for the application of this recipe contains ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required