Hi,
I have a repeat control and a switch control inside. The code :
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:fp="urn:formsplayer.com"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf11="http://www.w3.org/2004/xforms/"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:h20="http://www.w3.org/2001/06/html"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
>
<object classid="CLSID:4D0ABA11-C5F0-4478-991A-375C4B648F58"
id="formsPlayer" height="0" width="0" >
<b >formsPlayer has failed to load! Please check your
installation.</b>
</object>
<?import namespace="xf" implementation="#formsPlayer" ?>
<head >
<link type="text/css" rel="stylesheet" href="css/demo.css"
media="screen" />
<meta name="noDemoCss" content="false" />
<meta name="screenshot" content="images/sshots/print-
settings-repeat.gif" />
<title>Test Toggle</title>
<xf:model id="myModel" functions="fp:HTMLserialise">
<xf:instance id="iSave">
<root xmlns="">
<itemList>
<item/>
</itemList>
</root>
</xf:instance>
<xf:instance id="iTest">
<root xmlns="">
<itemList>
<item>premier</item>
<item>second</item>
<item>troisième</item>
<item>quatrième</item>
<item>cinquième</item>
<item>sixième</item>
</itemList>
</root>
</xf:instance>
<xf:instance id="iTemp">
<root xmlns="">
<item />
<isSave />
</root>
</xf:instance>
<xf:bind id="btnSwitch" nodeset="instance
('iTest')/itemList" relevant="count(instance('iSave')/itemList/item
[last()]/preceding-sibling::*) = count(instance
('iSave')/itemList/item) - 1" />
</xf:model>
<style>
.disabled {display:none;}
xf\:trigger .lastTest:first-child {background-
color:lime;}
div p:first-child {background-color:lime;}
div p { font-weight:normal; }
div p:first-line { font-weight:bold; }
div p:first-letter { font-size:300%; color:red }
div { background-color:#E0E0E0 }
div p:first-child { background-color:black; }
</style>
</head>
<body >
<div>
<p>test1 <br /> test1.1</p>
<p>test2</p>
</div>
<xf:repeat id="rptTest" nodeset="instance
('iSave')/itemList/item">
<xf:switch style="display: inline-block;">
<xf:case id="inTestList">
<xf:select1 id="selTest"
ref=".">
<xf:itemset
nodeset="instance('iTest')/itemList/item">
<xf:label
ref="." />
<xf:value
ref="." />
</xf:itemset>
</xf:select1>
<xf:trigger bind="btnSwitch"
id="tr" appearance="minimal" style="text-decoration:
underline;cursor:pointer;" >
<xf:label>Ajouter à
la liste</xf:label>
<xf:action
ev:event="DOMActivate">
<xf:toggle
case="outTestList" />
<xf:setfocus
control="addList"/>
<xf:setvalue
ref="instance('iTemp')/isSave" value="boolean-from-string
('false')" />
</xf:action>
</xf:trigger>
</xf:case>
<xf:case id="outTestList">
<xf:group style="background-
color:Gray;">
<xf:input
id="addList" ref="instance('iTemp')/item" />
<xf:trigger id="tr"
appearance="minimal" class="lastTest">
<xf:label>Sauvegarder</xf:label>
<xf:action
ev:event="DOMActivate">
<xf:action if="instance('iTemp')/item = ''">
<xf:setvalue ref="instance('iTemp')/isSave" value="boolean-
from-string('true')" />
<xf:toggle case="inTestList" />
<xf:setfocus control="selTest"/>
</xf:action>
<xf:action if="instance('iTemp')/item != ''">
<!-- Création d'un item supplémentaire dans la nomenclature -
->
<!-- cette ligne sera remplacée par un appel BDD pour mettre
à jour la liste de référence -->
<xf:duplicate
ref="instance('iTest')/itemList"
origin="instance('iTemp')/item"
/>
<xf:setvalue ref="instance('iSave')/itemList/item[index
('rptTest')]" value="instance('iTemp')/item"/>
<xf:setvalue ref="instance('iTemp')/isSave" value="boolean-
from-string('true')" />
<xf:setvalue ref="instance('iTemp')/item" value=""/>
<xf:toggle case="inTestList" />
<xf:setfocus control="selTest"/>
</xf:action>
</xf:action>
</xf:trigger>
<xf:action
ev:event="DOMFocusOut">
<xf:action
if="instance('iTemp')/isSave='false'">
<xf:message level="modal"><xf:label>La sauvegarde n'a pas
été effectuée</xf:label></xf:message>
<xf:setfocus control="addList"/>
</xf:action>
</xf:action>
</xf:group>
</xf:case>
</xf:switch>
<br />
</xf:repeat>
<!--
<xf:repeat id="rptTest" nodeset="instance
('iSave')/itemList/item">
<xf:select1 id="selTest" ref=".">
<xf:itemset nodeset="instance
('iTest')/itemList/item">
<xf:label ref="." />
<xf:value ref="." />
</xf:itemset>
</xf:select1>
</xf:repeat>
-->
<br />
<xf:trigger id="btnAddMessage" appearance="minimal">
<xf:label>Add</xf:label>
<xf:hint>Ajouter un message</xf:hint>
<xf:insert nodeset="instance
('iSave')/itemList/item" at="index('rptTest')" position="after"
ev:event="DOMActivate" />
<xf:rebuild model="document"/>
</xf:trigger>
 
<xf:trigger id="btnDeleteMessage"
appearance="minimal">
<xf:label>remove</xf:label>
<xf:hint>Supprimer un message</xf:hint>
<xf:delete nodeset="instance
('iSave')/itemList/item" at="index('rptTest')"
ev:event="DOMActivate" />
<xf:rebuild model="document"/>
</xf:trigger>
<br />
<br />
<br />
<xf:output value="fp:HTMLserialise(instance
('iTest'))">
<xf:label>Etat de l'instance : </xf:label>
</xf:output>
<br />
<br />
<br />
<xf:output value="fp:HTMLserialise(instance
('iSave'))">
<xf:label>Etat de l'instance de sauvegarde :
</xf:label>
</xf:output>
<br />
<br />
<br />
<xf:output value="fp:HTMLserialise(instance
('iTemp'))">
<xf:label>Etat de l'instance temporaire :
</xf:label>
</xf:output>
<br />
<xf:output value="count(instance
('iSave')/itemList/item)"><xf:label>Nombre d'items dans l'instance
de sauvegarde : </xf:label></xf:output>
<br />
<xf:output value="count(instance
('iSave')/itemList/item[last()]/preceding-
sibling::*)"><xf:label>Nombre d'items précédent :
</xf:label></xf:output>
<br />
<xf:output value="instance('iSave')/itemList/item
[last()]"><xf:label>valeur du dernier noeud : </xf:label></xf:output>
</body>
</html>
I would like to display only the last trigger ("btnAddMessage"). IE
doesn't know first-child and last-child css pseudo element.
How can I do ?
Thanks a lot.
Frédéric