ClarkePeter’s Weblog

January 30, 2008

Xforms Multiple Constraints

Filed under: Uncategorized, Xforms, php, xhtml — clarkepeters @ 4:51 am

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″ model=”login”>
<xf:label>pw1 </xf:label>
</xf:input>

<xf:input ref=”//password2″ model=”login”>
<xf:label>pw2 </xf:label>
</xf:input>

<xf:input ref=”//email1″ model=”login”>
<xf:label>em1 </xf:label>
</xf:input>

<xf:input ref=”//email2″ model=”login”>
<xf:label>em2 </xf:label>
</xf:input>

<xf:submit submission=”loginsubmit”>
<xf:label>Log In</xf:label>
</xf:submit>
</body>
</html>

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress – Hosted by <ixwebhosting.com>