Skip to content

Instantly share code, notes, and snippets.

@sardinecan
Created June 16, 2019 11:53
Show Gist options
  • Save sardinecan/9365dcaa6ed89c68310d796314c7b239 to your computer and use it in GitHub Desktop.
Save sardinecan/9365dcaa6ed89c68310d796314c7b239 to your computer and use it in GitHub Desktop.
Récupétation de données au chargement du formulaire à partir d'une autre instance
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>XForms inputs with labels</title>
<xf:model>
<xf:action ev:event="xforms-ready">
<xf:setvalue ref="instance('empty')/fullName" value="concat(instance('prefilled')/forename, ' ', instance('prefilled')/surname)"/>
</xf:action>
<xf:instance id="prefilled">
<person xmlns="">
<forename>Édouard</forename>
<surname>Bracame</surname>
</person>
</xf:instance>
<xf:instance id="empty">
<person xmlns="">
<fullName/>
</person>
</xf:instance>
</xf:model>
</head>
<body>
<p>Récupération de valeur et concaténation</p>
<xf:input ref="instance('empty')/fullName" incremental="true">
<xf:label>Nom importé depuis une instance préremplie :</xf:label>
</xf:input>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment