php

XML: Use PHP to Create XForms

XML: Use PHP to Create XForms

Xforms Multiple Constraints

Here is an example code for how to do multiple constraints on a form.
<?xml version=”1.0″ ?>
<?xml-stylesheet href=”xforms.css” type=”text/css”?>
<html xmlns=”http://www.w3.org/1999/xhtml”
xmlns:xf=”http://www.w3.org/2002/xforms”>
<head>
<title>Using XForms</title>
<xf:model id=”login”>
<xf:instance xmlns=”">
<verifyUser>
<userID1/>
<userID2/>
<password1/>
<password2/>
<email1/>
<email2/>
</verifyUser>
</xf:instance>
<!– This will NOT work!! (although it will work for a singlen constraint)
<xf:bind constraint=”//userID1=//userID2″ />
<xf:bind constraint=”//password1=//password2″/>
<xf:bind constraint=”//email1=//email2″/>
–>
<xf:bind nodeset=”//userID1″ constraint=”.=//userID2″/>
<xf:bind nodeset=”//password1″ constraint=”.=//password2″/>
<xf:bind nodeset=”//email1″ constraint=”.=//email2″/>
<xf:submission action=”viewsubmitdata.php” method=”post” id=”loginsubmit”/>
</xf:model>
</head>
<body>
<xf:input ref=”//userID1″ model=”login”>
<xf:label>Username1 </xf:label>
</xf:input>
<xf:input ref=”//userID2″ model=”login”>
<xf:label>Username2 </xf:label>
</xf:input>
<xf:input ref=”//password1″ [...]

An Xquery article by Kurt Cagle

XQuery, the Server Language
An Xquery article by Kurt Cagle.

A better Legendary Toggle

I put a toggle inside a legend simply because it just popped in my head to try it. This same procedure could work with any type of grouped data without having a legend at all (see Switch/Case Toggle Template or Using Switch Case as a drop down box).
In my post Xforms: The Legendary [...]

Thoughts on xforms php and the DOM

Anyone who has followed my blog knows that I use php to parse my xml data by simply putting my data into an indexed array or an associative array and then manipulating the data as you would any other arrayed data (see http://clarkepeters.wordpress.com/2007/09/02/parsing-without-the-dom-or-.... I’m not advocating, however, that this is the best [...]

Hiding dropovers with CSS and Xforms

A dropover is a drop box that is intended to drop down over any elements that are displayed below it.
For an example see Drop Down over/above lower text (Xforms Switch and CSS). In fact, you’ll need to look over that post to get an idea of what’s going on here (you may want [...]

No files selected (using xf:bind and relevant)

I have an xhtml+xforms form in which users are viewing or deleting files from their server. (see earlier posts if you want to know more).
The file names are stored in an xml instance that the xforms is based on. The file names are listed as items in an xf:select1 control (actually in this case, it’s [...]

Drop Down over/above lower text (Xforms Switch and CSS)

Here are some images that show how the Switch/Case Toggle works (see Switch/Case Toggle Template ) . In this particular example, notice how the box drops down above the division below it rather then pushing that division down (which is how it normally operates without any CSS styling). [...]

Switch/Case Toggle Template

Here’s template I keep handy for what I call my switch/case toggle box– I use it especially for tips and notes but it could be used for just about anything.
<!– ********** SWITCH/CASE TOGGLE***************************** –>
<!– Lorem ipsum –>
<xf:switch>
[...]

Directory list: process delete files

Previously we set up our Xforms to send some file names to our php file (see Directory List: Delete files )
Here’s the php to process them.
<?php
header(”Content-type: application/xhtml+xml”);
//header(”Content-type: text/plain”);

include(”fnGeneric.php”);
include(”fnMisc.php”);

if (!isset($HTTP_RAW_POST_DATA))
$HTTP_RAW_POST_DATA = file_get_contents(”php://input”);

//put the data into an associative array (see my Parsing without the DOM for this function)
$data=xmlSTR2xmlAssocARR($HTTP_RAW_POST_DATA);

/* an Xforms select control [...]

Using Xforms for Redirecting/Reloading pages

In an earlier post– don’t hit the back arrow! — I was using Xforms to prevent loss of recent data from a browsers back button or browser reload page, in which case the user would be directed to an interim page that had some instructions about navigating the site and also a button where they [...]

Migration in progress … … …

We still have some things to do, but the old posts have now been moved to the new site.
at: http://ztags4xforms.com/wordpress/

When should I use XForms?

The question about how XForms should be sold to customers often comes up, and generally we reply "why would you?". As in any IT project you need to use the right tool for the job, so why would you try to sell XForms in and of itself? Sometimes XForms is the right thing, and sometimes not, but either way--we say to those who ask--it's a tool in your armoury (if you want to use it), not your customers'.

If you have a system that uses web services a lot (for example), then a rich client that can handle XForms will be ideal--that's where most of our use cases are coming from for formsPlayer deployment. I've mentioned before a system that we've built for a customer that involves using the OpenWFE workflow engine and the eXist XML database, and we've written practically no code on the server! All we've done is used a few workflow templates, and the REST/XQuery interface to eXist, and everything else is achieved via the XForms themselves. Maintaining such a system is not only very straightforward, but is easy to move to other platforms, as well as swap components in and out (since the interfaces--such as XQuery--are all standard). This is all at the heart of the skimming approach we've been talking about.

But unfortunately, at the other end of the spectrum, if you have a system that uses a server-side scripting language, with direct queries on a database to populate list-boxes (that whole nineties thing!) then you might not find XForms that useful. You'll have a maintenance nightmare with such an application, either way. For XForms to be of benefit in this scenario it would have to dramatically improve the user experience, rather than only being 'as good' as what you have already.

I'm not differentiating here between using client and server technologies, but rather between the use of high-level constructs versus painstakingly creating pages with server-side script. So in the approach I'm suggesting, you will also get productivity improvements if you can use a pipeline-based system like Orbeon, since it too uses 'big constructs', even though it delivers HTML to the user.

At least in the short term, the main benefits of XForms will generally accrue to the developers and not to the users, and will be of most use to those who have a service oriented architecture, rather than an old-fashioned web-site. So trying to 'sell XForms' is probably not only a waste of time, but actually unnecessary--if it fits your system, use it.