Clear a grid or section full of controls on a button press

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Clear a grid or section full of controls on a button press

krowe
I have been trying to find a way to have a button clear a grid or section.

What I am hoping to do is have a button in the gird that will remove all values that have been entered. I have a few sections with 40 plus controls that I would need to clear.
 
Example:

I want to clear 2 radio buttons and a textarea when a button is pressed.

I have tried using the lines below.

<xxforms:variable name="Username-name" select="'******'" as="xstring"/>
<xforms:setvalue ref="instance('fr-form-instance')/*/*[name() = $*****-name]" value=""/>

Or how would I use the line below to uncheck a radio button.

ORBEON.xforms.Document.setValue("foo", Number(fooValue) + 1);

If anyone has any ideas or can point me to a post that is similar that would be great.
 
Thanks for your time!
- Kevin
Reply | Threaded
Open this post in threaded view
|

Re: Clear a grid or section full of controls on a button press

Hank Ratzesberger-3
Hi Kevin,

This should possible by setting the <xforms:action> for the buttion / trigger,
and it should not be necessary to use the JavaScript hook (and indeed i 
think there may be some side effects with that.

<xforms:trigger>
  <xforms:label>Clear</xforms:label>
  <xforms:action ev:event="DOMActivate">
    <xforms:setvalue ref="??????" value="''"/>
  </xforms:action>
</xforms:trigger>

I hope that helps.  The XForms engine should redraw the controls.

HTH,
Hank

On Wed, Feb 15, 2012 at 12:24 PM, krowe <[hidden email]> wrote:
I have been trying to find a way to have a button clear a grid or section.

What I am hoping to do is have a button in the gird that will remove all
values that have been entered. I have a few sections with 40 plus controls
that I would need to clear.

Example:

I want to clear 2 radio buttons and a textarea when a button is pressed.

I have tried using the lines below.

<xxforms:variable name="Username-name" select="'******'" as="xstring"/>
<xforms:setvalue ref="instance('fr-form-instance')/*/*[name() =
$*****-name]" value=""/>

Or how would I use the line below to uncheck a radio button.

ORBEON.xforms.Document.setValue("foo", Number(fooValue) + 1);

If anyone has any ideas or can point me to a post that is similar that would
be great.

Thanks for your time!
- Kevin


--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Clear-a-grid-or-section-full-of-controls-on-a-button-press-tp4391826p4391826.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
Hank Ratzesberger
XMLWerks.com



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Clear a grid or section full of controls on a button press

Binesh Gummadi
Krowe,

As Erik mentioned in the other thread you could use xxf:iterate.

https://gist.github.com/1837412

Replace the input from the example with a trigger

<xf:input ref="readonly">
            <xf:setvalue ev:event="xforms-value-changed" xxf:iterate="../section/*" ref="."/>
        </xf:input>

to

<xforms:trigger>
  <xforms:label>Clear</xforms:label>
  <xforms:action ev:event="DOMActivate">
    <xf:setvalue ev:event="xforms-value-changed" xxf:iterate="../section/*" ref="."/>
  </xforms:action>
</xforms:trigger>




Binesh Gummadi
Senior Software Engineer
rivetlogic
Voice <a href="tel:%2B1.703.879.5740" value="+17038795740" target="_blank">+1.703.879.5740
Skype binesh.gummadi_rivetlogic
GTalk [hidden email]
Calendarbinesh gummadi's calendar



On Thu, Feb 16, 2012 at 2:33 PM, Hank Ratzesberger <[hidden email]> wrote:
Hi Kevin,

This should possible by setting the <xforms:action> for the buttion / trigger,
and it should not be necessary to use the JavaScript hook (and indeed i 
think there may be some side effects with that.

<xforms:trigger>
  <xforms:label>Clear</xforms:label>
  <xforms:action ev:event="DOMActivate">
    <xforms:setvalue ref="??????" value="''"/>
  </xforms:action>
</xforms:trigger>

I hope that helps.  The XForms engine should redraw the controls.

HTH,
Hank

On Wed, Feb 15, 2012 at 12:24 PM, krowe <[hidden email]> wrote:
I have been trying to find a way to have a button clear a grid or section.

What I am hoping to do is have a button in the gird that will remove all
values that have been entered. I have a few sections with 40 plus controls
that I would need to clear.

Example:

I want to clear 2 radio buttons and a textarea when a button is pressed.

I have tried using the lines below.

<xxforms:variable name="Username-name" select="'******'" as="xstring"/>
<xforms:setvalue ref="instance('fr-form-instance')/*/*[name() =
$*****-name]" value=""/>

Or how would I use the line below to uncheck a radio button.

ORBEON.xforms.Document.setValue("foo", Number(fooValue) + 1);

If anyone has any ideas or can point me to a post that is similar that would
be great.

Thanks for your time!
- Kevin


--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Clear-a-grid-or-section-full-of-controls-on-a-button-press-tp4391826p4391826.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
Hank Ratzesberger
XMLWerks.com



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws