HTML and CSS Reference
In-Depth Information
You can also use getFile to create a new FileEntry, if it doesn't exist, by passing a con-
figuration object to the method. The code in listing 3.14 shows how to do this. The logic
for creating a new file will be placed in the event handler, createFormSubmit , and
attached to the File Browser create button. CreateFormSubmit will perform basic val-
idation to ensure that the user is creating an HTML file and that the file doesn't already
exist, and if all validation passes, it will create the file. Add this code directly after the de-
leteFile function.
Listing 3.14. aapp.js—Creating a new empty file
Progress check: try it out!
Finally! You can test the code! You should be able to create empty files using the form
on the File Browser view, as illustrated in figure 3.6 . When the file has been created, you
 
Search WWH ::




Custom Search