On Feb 21, 2013, at 6:58 PM, C. M. Sperberg-McQueen wrote:
> My apologies if this is a question that's already been asked and
> clarified; I have not yet found any discussion of it, but I am still looking.
>
> I have a form which users employ to make systematic changes to
> XML documents they are working on. From time to time, I would
> like them to save their work. So I have a Save button that performs
> a PUT to the server, and updates nothing (so they can continue to
> work).
>
> Question 1: can I tell somehow whether the PUT was successful
> or not? I'd like to be able to indicate (maybe with an alert, or just
> some conditional text int he form) "the document has been saved"
> or "there was an error, the document was not saved".
You know, it's amazing how easy it is to find the information
you want in the spec, if first you admit publicly that you don't know
the answer and ask for help. Having sent my query, I looked at
the spec and found the discussion of the xforms-submit-done and
xforms-submit-error.
I replaced the following submission:
<xf:submission id="save"
method="put"
replace="none">
<xf:resource value="concat('/security-through-obscurity/',
instance('ui')/document-id )"/>
</xf:submission>
with the following elaboration:
<xf:submission id="save"
method="put"
replace="none">
<xf:resource value="concat('/security-through-obscurity/',
instance('ui')/document-id )"/>
<xf:message ev:event="xforms-submit-done">Save was
successful!</xf:message>
<xf:message ev:event="xforms-submit-error">Oops! Document was not
successfully saved!
Write down the following information and report the problem:
A submission error (<xf:output value="event('error-type')"/>)
occurred.
Response: <xf:output value="event('response-status-code')"/>.
Reason given: <xf:output value="event('response-reason-phrase')"/>.
</xf:message>
</xf:submission>
And the form now tells the user explicitly whether the save was successful
or not.
I expect my users will get sick of the dialog box popping up on success, and
I may look for a way to make the success indicator less obtrusive, but
the error box will be helpful.
My question about evading an over-enthusiastic cache remains
an open question.
--
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support