XForms Everywhere

4/18/2006

Confirmation With XForms

Filed under: General — Alessandro Vernet @ 7:19 pm



In Web pages using Ajax, when you click on a button or a link, instead of loading another page, that click often starts a background request to the server, and the page then updates based on the response received from the server. If the action is destructive, it might make sense to ask users to confirm their intent. A pop-up is a simple but not very elegant solution. Instead, we can replace the button or link with the confirmation message, as shown in the animation on the right. And you can do this in just a few lines of XForms:

<xforms:switch>
    <xforms:case id="delete">
        <xforms:trigger appearance="xxforms:link">
            <xforms:label>Delete</xforms:label>
            <xforms:toggle case="confirm" ev:event="DOMActivate"/>
        </xforms:trigger>
    </xforms:case>
    <xforms:case id="confirm">
        Are you sure?
        <xforms:trigger appearance="xxforms:link">
            <xforms:label>Delete</xforms:label>
            <xforms:action ev:event="DOMActivate">
                ... Perform actual deletion here ...
                <xforms:toggle case="delete"/>
            </xforms:action>
        </xforms:trigger>
        <xforms:trigger appearance="xxforms:link">
            <xforms:label>Cancel</xforms:label>
            <xforms:toggle case="delete" ev:event="DOMActivate"/>
        </xforms:trigger>
    </xforms:case>
</xforms:switch>

4/6/2006

XML and XForms Can Really be More Productive

Filed under: General — Erik Bruchez @ 10:20 am

Country List

I just hit a really telling example of how XML and XForms can deliver incredible productivity. The requirement: creating a dropdown menu displaying the list of all the world’s countries in French, using ISO names and codes. Here is how you do it with XForms:

  1. Download the XML file containing the list of countries from ISO (after finding it with Google). The file contains entries of the type:

    <ISO_3166-1_Entry>
        <ISO_3166-1_Country_name>SUISSE</ISO_3166-1_Country_name>
        <ISO_3166-1_Alpha-2_code>CH</ISO_3166-1_Alpha-2_code>
    </ISO_3166-1_Entry>
    
  2. Import the file in your XForms page with:

    <xforms:instance id="countries-instance" src="iso_3166-1_list_fr.xml"/>
    
  3. Refer to the list of country from the select1 control:

    <xforms:select1 ref="country" appearance="minimal">
        <xforms:label>Country</xforms:label>
        <xforms:itemset nodeset="instance('countries-instance')/*">
            <xforms:label ref="ISO_3166-1_Country_name"/>
            <xforms:value ref="ISO_3166-1_Alpha-2_code"/>
        </xforms:itemset>
    </xforms:select1>
    

And that’s it! Can you actually imagine anything simpler, in any language?

4/4/2006

Automatic Loading Indicator

Filed under: General — Alessandro Vernet @ 9:33 am

Automatic loading indicator L&FWe have just enhanced PresentationServer adding an automatic loading indicator. PresentationServer gives you an Ajax XForms engine: you write standard XForms, PresentationServer renders it in an Ajax web page that runs in mainstream browsers.

With XForms, you can implement forms where server-side processing happens as the end-user interacts with the page; feedback is given to the end-user on the same page, without having to reload another page. The instant translation page shows this: a translation of the text you enter is provided as you type.

However, as you interact with the page, it is not always clear when server-side processing is happening. For this reason, if a request takes more than certain number of milliseconds, which you can setup in PresentationServer, a loading indicator will be displayed automatically.

Try it out in the instant translation page.

4/3/2006

W3C XForms Working Group Going public

Filed under: General — Erik Bruchez @ 4:05 pm

W3C XForms

The W3C XForms working group has informally decided to be more active on the public XForms mailing-list (archives, RSS feed). Until now there had been no such policy and most of the discussions were taking place in the working group’s private mailing-list.

This makes the XForms working group a tad closer to the strategy adopted by the XML Processing working group, which has only a public mailing-list and which publishes all its meeting minutes publicly.

Such openness will hopefully make the working group’s activity more understandable and more friendly-looking to outside observers. So if you work with XForms, subscribe, ask and contribute: you should get great feedback from working group members!

Powered by WordPress