Ken,
Just have a quick question. In the demo I saw that there were some
buttons (maybe they were in admin gui), which change text to
"Processing" while it was processing data. How do you do that?
thanks
Karam
Ken Paulsen wrote:
>
> Hi Priti,
>
> The following blog has a "download" link to the example in the blog:
>
>
> http://blogs.sun.com/paulsen/entry/jsftemplating_dynamicfaces_easy_ajax
>
> Attached is the page I made right before the meeting that "counts".
>
> Ken
>
> Priti Tiwary wrote:
>> Hi Ken,
>> In your blog can you include the Ajax Dynafaces examples you demoed
>> today?
>> Priti
> ------------------------------------------------------------------------
>
> <sun:html>
> <sun:head title="Ajax Zone">
> <!-- <jsfExt:scripts /> -->
> <f:verbatim>
> <script type="text/javascript">
> function refreshTime() {
> window.setTimeout(
> 'DynaFaces.fireAjaxTransaction(document.getElementById(\\'form:count\\'), '
> + '{'
> + ' execute: \\'form:count\\','
> + ' immediate: false,'
> + ' inputs: \\'form:count\\','
> + ' render: \\'form:count\\''
> + '});'
> + 'refreshTime();',
> 1000);
> }
> </script>
> </f:verbatim>
> </sun:head>
>
> <sun:body onLoad="refreshTime('form:count')">
> <sun:form id="form">
> "<center><p> </p>
> <staticText id="count" value='<div id="form:count">#{pageSession.count}</div>'>
> <!beforeCreate
> setPageSessionAttribute(key="count" value="1");
> />
> <!beforeEncode
> inc("#{pageSession.count}" value=>$pageSession{count});
> println("here");
> />
> </staticText>
>
> <sun:markup tag="div" id="result">
> <staticText value="#{pageSession.msg}">
> <!beforeCreate
> setPageSessionAttribute(key="msg" value="Guess my number [1-100]!");
> />
> </staticText>
> </sun:markup>
>
> "<p> </p>
>
>
> // The data input / processing...
> <sun:textField id="guess" label="Your guess: " value="#{requestScope.guess}" />
> <sun:button text="Submit AJAX Request" onClick="
> DynaFaces.fireAjaxTransaction(this, {execute: this.id + ',form:guess', immediate: false, inputs: this.id + ',form:guess_field', render: 'form:result' });
> return false;
> ">
> <!command
> if ("#{requestScope.guess}>64") {
> setPageSessionAttribute(key="msg" value="#{requestScope.guess} is too high!");
> }
> if ("#{requestScope.guess}=64") {
> setPageSessionAttribute(key="msg" value="You WIN!!! It was #{requestScope.guess}.");
> }
> if ("#{requestScope.guess}<64") {
> setPageSessionAttribute(key="msg" value="#{requestScope.guess} is too low!");
> }
> />
> </sun:button>
>
> "<p> </p>
>
> // This fields below exist to show required fields are NOT effected
> <sun:textField label="This is required: " required="#{true}" />
> <sun:button text="Submit (non-AJAX)" />
>
> "</center>
> </sun:form>
> </sun:body>
> </sun:html>
>