Using the required property we have now been able to prevent any data being sent to del.icio.us if one or other of the obligatory fields is missing. However, as things stand the user of our form would be none the wiser as to what has gone wrong, and may even just keep pressing the Save button.
In HTML, the usual way to provide feedback to the user is to call the alert() function in script. This doesn't give us very rich messages though, so XForms solves this--in just the same ways as it did with hint and help which we discussed before--by providing the message element.
Let's see what a message that tells the user that they haven't entered enough information for the form to proceed, might look like:
<xf:message level="modal"> Please ensure that you have entered both a URL <em>and</em> a description. </xf:message>
The level attribute indicates what type of message we want, and in this case we're using a modal message, which halts processing until the user acknowledges it.
But when does this message get displayed to the user? As it stands, never. This is because the message element is one of a number of XForms handlers which will do a specific task, but will only do so when instructed to. However, we know when we want this action to be performed, and that is when there is an error on submission of the data; so to ensure that our message action is carried out we need to register for the notification that will be issued when a submission error occurs.


Recent comments
3 weeks 1 day ago
4 weeks 4 days ago
4 weeks 5 days ago
4 weeks 5 days ago
5 weeks 9 hours ago
5 weeks 18 hours ago
5 weeks 21 hours ago
5 weeks 22 hours ago
5 weeks 4 days ago
5 weeks 4 days ago