Re: [Xsltforms-support] refreshing the screen while performing a submission - why does this not wor
Brought to you by:
alain-couthures
From: C. M. Sperberg-M. <cm...@bl...> - 2016-07-05 19:24:37
|
On Jun 28, 2016, at 1:37 PM, Alain Couthures wrote: > As a possible workaround, you might try to insert the text, before the > submission being effectively sent, at the event "xforms-submit-serialize". Thank you for the suggestion. I have now finally had the opportunity to try it. For the record, this form of the submission did not work: <xf:submission id="send-query" resource="./balbus.php" method="get" replace="instance" instance="results"> <xf:delete ev:event="xforms-submit" nodeset="instance('results')/child::node()"/> <xf:insert ev:event="xforms-submit-serialize" context="instance('results')" origin="instance('ui')/query-in-progress"/> </xf:submission> (The use of different events on the delete and insert was an attempt to force them to happen in a particular order. Using xforms-submit-serialize on both didn't work, either.) But when the submission takes this form, I got the desired behavior (the old results vanish and the text 'Query in progress' appears instead): <xf:submission id="send-query" resource="./balbus.php" method="get" replace="instance" instance="results"> <xf:setnode ev:event="xforms-submit-serialize" ref="instance('results')" inner="serialize(instance('ui')/query-in-progress)"/> </xf:submission> I do not understand why setnode should work when insert + delete does not (and if anyone reading this understands why, I'll be glad of an explanation), but for the moment I'm happy, and I record this outcome for the sake of anyone who finds this thread while trying to solve a similar problem. Michael > > Thank you for your feedback! > > --Alain > > Le 20/06/2016 à 20:32, C. M. Sperberg-McQueen a écrit : >> I have a form that performs a query against a database back end, >> shows the results, and keeps the search box open so the user can >> issue a new search. >> >> http://tlrr.blackmesatech.com/2016/01/balbus.xhtml >> >> (Useful searches: "Alfenus", "Balbus" for fast searches, "Cicero" for a >> slower one.) >> >> In the current version of the form, nothing visual happens when >> the user issues a new search; if the search is slow, the user can think >> "something went wrong, the browser didn't notice the click, I'll >> click again". So I'd like the Search button to clear the old results, >> display the text "Query in progress ..." in some way (ideally in the >> work area where the results used to be), and issue the query submission >> to the back end. >> >> A first cut made the trigger look like this: >> >> <xf:trigger> >> <xf:label>Search</xf:label> >> <xf:action ev:event="DOMActivate"> >> <xf:delete nodeset="instance('results')/child::node()"/> >> <xf:insert context="instance('results')" origin="instance('ui')/query-in-progress"/> >> <xf:setvalue ref="instance('q')/startpos" value="1"/> >> <xf:send submission="send-query"/> >> </xf:action> >> </xf:trigger> >> >> And I added the 'Query in progress ...' display this way: >> >> <xf:group ref="instance('results')/query-in-progress"> >> <p>Query in progress ...</p> >> </xf:group> >> >> (It should be noted that the send-query submission replaces the >> 'results' instance entirely, so the empty 'query-in-progress' element >> there goes away when the results of the query are returned.) >> >> The trigger and group just shown, however, do not in fact make >> the old results disappear or the text "Query in progress ..." appear; >> there no change to the display until the results of the query come back. >> >> Consulting the spec, I see that my problem is apparently described >> in the section on 'deferred updates', near the beginning of section 10: >> >>> Deferred Updates: Sequences of one or more XForms Actions have a deferred effect on XForms model and user interface processing. Implementations are free to use any strategy to accomplish deferred updates, but the end result must be as follows: Instance data changes performed by a set of actions do not result in immediate computation dependency rebuilding, recalculation, revalidate and form control refreshing until the termination of the outermost action handler, as described here. >> OK, I think I can see the point of that rule. >> >> Later on in the same section, however, it says >> >>> Actions that directly invoke rebuild, recalculate, revalidate, or refresh always have an immediate effect, and clear the corresponding deferred update flag. The XForms Actions in this category are: >>> >>> rebuild >>> recalculate >>> revalidate >>> refresh >> So I tried inserting first one, then a different one, and finally all four of these actions >> into my trigger: >> >> <xf:trigger> >> <xf:label>Search</xf:label> >> <xf:action ev:event="DOMActivate"> >> <!--* <xf:message level="ephemeral">Query in progress</xf:message> *--> >> <xf:delete nodeset="instance('results')/child::node()"/> >> <xf:insert context="instance('results')" origin="instance('ui')/query-in-progress"/> >> >> <xf:rebuild/> >> <xf:recalculate/> >> <xf:revalidate/> >> <xf:refresh/> >> >> <xf:setvalue ref="instance('q')/startpos" value="1"/> >> <xf:send submission="send-query"/> >> </xf:action> >> </xf:trigger> >> >> The result is that the behavior is still unchanged. Have I misunderstood the spec? >> Am I doing something wrong? >> >> How can I cause a single button press to (a) clear the results and display a 'be patient' >> message, and (b) perform a submission which will automatically clear that be-patient >> message when the results come back? >> >> Thanks for any help. >> > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support -- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net **************************************************************** |