|
From: Dan M. <dan...@gm...> - 2014-01-16 16:08:25
|
You might not be using the right "context" in your delete. There are two
styles, one that you put the delete in each row of the repeat and one that
you reference the current selected item.
You might also want to shift from "nodeset" to "ref" since "nodeset" is no
longer being used:
<xf:delete nodeset="level.doors" at="index('level.doors.repeat'
)"></xf:delete>
change to remove the nth item in a repeat which is the selected item. Use
a predicate to find the nth door.
<xf:delete ref="instance('level.doors.template')//door[
index('level.doors.repeat')]"/>
Try that!
On Thu, Jan 16, 2014 at 9:54 AM, Alex Muir <ale...@gm...> wrote:
> Hi,
>
> With the following code, I can delete the 'Currently Selected Level.Doors '
>
> However I'm unable to delete the currently selected door and can't not
> figure out why.
>
> When I click on a door and the trigger to delete the door the debugged
> outputs blank blue lines
>
> Any help would be greatly appreciated..
>
> xquery version "1.0";
>
> declare option exist:serialize "method=xhtml media-type=text/xml
> indent=yes process-xsl-pi=no";
>
> let $form :=
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="
> http://www.w3.org/2001/xml-events"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xf="
> http://www.w3.org/2002/xforms" xmlns:my="test"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <head>
> <title>Activity</title>
> <meta name="author" content="alex.muir at kode1100.com" />
> <link rel="stylesheet" type="text/css" href="../styles/demo.css" />
> </head>
> <body class="soria" style="margin:30px;">
> <div id="xforms">
> <div style="display:none">
> <xf:model id="master" version="1.1"
> schema="../xsd/elt.activity.doors.xsd">
> <xf:instance xmlns="" id="activity"
> src="../data/elt.activity.doors.xml"></xf:instance>
> <xf:submission id="save" method="put" action="update.xq"
> instance="activity" replace="all"></xf:submission>
>
> <xf:instance id="level.doors.template">
>
> <level.doors>
> <question.doors>
> <rubric></rubric>
> <sound.rubric.file.name></sound.rubric.file.name>
> <door>
> <text></text>
> <image.file.name></image.file.name>
> <image.alt.text></image.alt.text>
> <sound.file.name></sound.file.name>
> <answer></answer>
> </door>
> </question.doors>
> </level.doors>
>
> </xf:instance>
> </xf:model>
> </div>
> </div>
> <xf:repeat id="instructions" nodeset="instructions.author/instruction"
> appearance="compact" class="contactsRepeat">
> <xf:output ref="text()">
> <xf:label class="Headline">Instruction</xf:label>
> </xf:output>
> </xf:repeat>
> <xf:group appearance="minimal">
> <xf:repeat id="level.doors.repeat" nodeset="level.doors"
> appearance="full" class="xfFullRepeat">
>
> <xf:label class="Section">Level.Doors</xf:label>
>
> <xf:repeat id="question.doors.repeat" nodeset="question.doors"
> appearance="full" class="xfFullRepeat">
> <xf:label class="Section">Question.Doors</xf:label>
>
> <xf:input class="resizedTextbox" ref="rubric">
> <xf:label class="xfLabel">Rubric</xf:label>
> </xf:input>
> <xf:input class="resizedTextbox" ref="sound.rubric.file.name">
> <xf:label class="xfLabel">Sound Rubric File Name</xf:label>
> </xf:input>
> <xf:group appearance="full">
> <xf:repeat id="door.repeat" nodeset="door" appearance="full"
> class="orderListRepeat">
> <xf:label class="Section">Door</xf:label>
> <xf:input class="PersonGivenName" ref="text">
> <xf:label class="xfValue">Text</xf:label>
> </xf:input>
> <xf:input class="resizedTextbox" ref="image.file.name"
> incremental="true">
> <xf:label class="xfValue">Image File Name</xf:label>
> </xf:input>
> <xf:input class="resizedTextbox" ref="image.alt.text">
> <xf:label class="xfValue">Image Alt Text</xf:label>
> </xf:input>
> <xf:input class="resizedTextbox" ref="sound.file.name">
> <xf:label class="xfValue">Sound File Name</xf:label>
> </xf:input>
> <xf:input class="resizedTextbox" ref="answer">
> <xf:label class="xfValue">Answer</xf:label>
> </xf:input>
> </xf:repeat>
> </xf:group>
>
> </xf:repeat>
>
> </xf:repeat>
> <table>
> <tr>
> <td class="orderListSpacerLeft"></td>
> <td>
> <xf:trigger class="orderListAddTrigger">
> <xf:label>Delete Currently Selected Level.Doors</xf:label>
> <xf:action>
> <xf:delete nodeset="level.doors"
> at="index('level.doors.repeat')"></xf:delete>
> </xf:action>
> </xf:trigger>
> </td>
> </tr>
> <tr>
> <td class="orderListSpacerLeft"></td>
> <td>
> <xf:trigger class="orderListAddTrigger">
> <xf:label>Delete Currently Selected Door</xf:label>
> <xf:action>
> <xf:delete nodeset="door" at="index('door.repeat')"></xf:delete>
> </xf:action>
> </xf:trigger>
> </td>
> </tr>
> <tr>
> <td class="orderListSpacerLeft"></td>
> <td>
> <xf:trigger class="orderListAddTrigger">
> <xf:label>Add Level Doors</xf:label>
> <xf:hint>Adds a new Level Doors</xf:hint>
> <xf:action>
> <xf:insert nodeset="level.doors" at="index('level.doors')"
> position="after"/>
> </xf:action>
> </xf:trigger>
> </td>
> </tr>
> </table>
> </xf:group>
> <xf:submit submission="save">
> <xf:label>Save</xf:label>
> </xf:submit>
> </body>
> </html>
>
>
> return $form
>
>
> Input file as follows
>
> <activity.doors>
> <instructions.author>
> <instruction>A Doors activity needs one or more levels containing
> questions.</instruction>
> <instruction>Each level of a Doors activity needs one or more
> questions.</instruction>
> <instruction>Each Doors question needs one rubric and two to six
> doors, only one of which is the correct answer.
> You’ll need to shuffle the doors into a random order.</instruction>
> <instruction>A door needs at least one of image or text. Delete
> sound, image and alt, or text lines if not
> used</instruction>
> </instructions.author>
> <level.doors>
> <question.doors>
> <rubric>Which one does not belong Here</rubric>
> <sound.rubric.file.name>be2_u01_go1.mp3</
> sound.rubric.file.name>
> <door>
> <text>What is another word for "luck"</text>
> <answer>Correct</answer>
> </door>
> <door>
> <image.file.name>XXXX_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer </image.alt.text>
> <answer>Incorrect</answer>
> </door>
> <door>
> <text>What is another word for "luck"</text>
> <image.file.name>be1_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer</image.alt.text>
> <sound.file.name>be2_u01_go1.mp3</sound.file.name>
> <answer>Incorrect</answer>
> </door>
> </question.doors>
> </level.doors>
> <level.doors>
> <question.doors>
> <rubric>Which one does not belong Or Here</rubric>
> <sound.rubric.file.name>be2_u01_go1.mp3</
> sound.rubric.file.name>
> <door>
> <text>What is another word for "luck"</text>
> <image.file.name>be1_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer</image.alt.text>
> <sound.file.name>be2_u01_go1.mp3</sound.file.name>
> <answer>Correct</answer>
> </door>
> <door>
> <text>What is another word for "luck"</text>
> <image.file.name>be1_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer</image.alt.text>
> <sound.file.name>be2_u01_go1.mp3</sound.file.name>
> <answer>Incorrect</answer>
> </door>
> <door>
> <text>What is another word for "luck"</text>
> <image.file.name>be1_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer</image.alt.text>
> <sound.file.name>be2_u01_go1.mp3</sound.file.name>
> <answer>Incorrect</answer>
> </door>
> </question.doors>
> </level.doors>
> <level.doors>
> <question.doors>
> <rubric>Which one does not belong Or Here</rubric>
> <sound.rubric.file.name>be2_u01_go1.mp3</
> sound.rubric.file.name>
> <door>
> <text>What is another word for "luck"</text>
> <image.file.name>be1_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer</image.alt.text>
> <sound.file.name>be2_u01_go1.mp3</sound.file.name>
> <answer>Correct</answer>
> </door>
> <door>
> <text>What is another word for "luck"</text>
> <image.file.name>be1_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer</image.alt.text>
> <sound.file.name>be2_u01_go1.mp3</sound.file.name>
> <answer>Incorrect</answer>
> </door>
> <door>
> <text>What is another word for "luck"</text>
> <image.file.name>be1_u01_g01_1.jpg</image.file.name>
> <image.alt.text>He's Using Computer</image.alt.text>
> <sound.file.name>be2_u01_go1.mp3</sound.file.name>
> <answer>Incorrect</answer>
> </door>
> </question.doors>
> </level.doors>
> </activity.doors>
>
>
> Regards
> --
> -
>
> Alex Muir
> http://ca.linkedin.com/pub/alex-muir/36/ab7/125
>
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Betterform-users mailing list
> Bet...@li...
> https://lists.sourceforge.net/lists/listinfo/betterform-users
>
>
--
Dan McCreary
http://danmccreary.com
Co-author: Making Sense of NoSQL <http://manning.com/mccreary>
office: (952) 931-9198
cell: (612) 986-1552
skype: dmccreary47
|