clean a template after an insert...

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

clean a template after an insert...

daniele ippoliti
Hello

I have a table defined with the repeat structure and I would like to add a new rows.

To do this I need to show to the user some new fields that he has to fill, I have done the followuing steps:
1) I have created an instance for the template "empty" that I would like to add to the XML file
2) I have created a table based on the elements on the XML file
3) when user click on Add new row I show to the user some fields to fill (these fields are linked to the template in order to keep the informations inserted by the user)
4) when the user has filled all the fields and he clicks on OK button I insert the structure on the XML file and I copy the value from the template to the new structure inserted.

the problem is that if the user tries to add a new field I have the template dirty of the previous data so I'll show to the user the form with the last inserted element but I wouldn't to have this behaviour

do you have any idea???

Daniele



--
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: clean a template after an insert...

Erik Bruchez
Administrator
Daniele,

You could use two instances:

* a clean template that you never modify (this could even be readonly
with xxforms:readonly="true")
* a "work in progress" template with the data filled by the user

Or you could clean the template after usage, for example with:

<xf:setvalue xxforms:iterate="instance('template')//*[not(*)]" ref="."/>

The above will blank all the elements that do not have children elements.

-Erik

On Tue, Apr 5, 2011 at 6:54 AM, daniele ippoliti <[hidden email]> wrote:

> Hello
>
> I have a table defined with the repeat structure and I would like to add a
> new rows.
>
> To do this I need to show to the user some new fields that he has to fill, I
> have done the followuing steps:
> 1) I have created an instance for the template "empty" that I would like to
> add to the XML file
> 2) I have created a table based on the elements on the XML file
> 3) when user click on Add new row I show to the user some fields to fill
> (these fields are linked to the template in order to keep the informations
> inserted by the user)
> 4) when the user has filled all the fields and he clicks on OK button I
> insert the structure on the XML file and I copy the value from the template
> to the new structure inserted.
>
> the problem is that if the user tries to add a new field I have the template
> dirty of the previous data so I'll show to the user the form with the last
> inserted element but I wouldn't to have this behaviour
>
> do you have any idea???
>
> Daniele
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Re: clean a template after an insert...

daniele ippoliti
Hello thanks for your suggestions

My need is to clean a template that is composed by only one node with all attributes setted and I would like to set NULL all the attribute values

I have tried to do something like this

<xf:setvalue ref="instance('templateRefPoint')[attribute::*]"  value=""/>

but I don't receive the behaviour that I expected


thanks for your help
Daniele

2011/4/6 Erik Bruchez <[hidden email]>
Daniele,

You could use two instances:

* a clean template that you never modify (this could even be readonly
with xxforms:readonly="true")
* a "work in progress" template with the data filled by the user

Or you could clean the template after usage, for example with:

<xf:setvalue xxforms:iterate="instance('template')//*[not(*)]" ref="."/>

The above will blank all the elements that do not have children elements.

-Erik

On Tue, Apr 5, 2011 at 6:54 AM, daniele ippoliti <[hidden email]> wrote:
> Hello
>
> I have a table defined with the repeat structure and I would like to add a
> new rows.
>
> To do this I need to show to the user some new fields that he has to fill, I
> have done the followuing steps:
> 1) I have created an instance for the template "empty" that I would like to
> add to the XML file
> 2) I have created a table based on the elements on the XML file
> 3) when user click on Add new row I show to the user some fields to fill
> (these fields are linked to the template in order to keep the informations
> inserted by the user)
> 4) when the user has filled all the fields and he clicks on OK button I
> insert the structure on the XML file and I copy the value from the template
> to the new structure inserted.
>
> the problem is that if the user tries to add a new field I have the template
> dirty of the previous data so I'll show to the user the form with the last
> inserted element but I wouldn't to have this behaviour
>
> do you have any idea???
>
> Daniele
>
> --
> 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




--
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: clean a template after an insert...

daniele ippoliti
I have tried accessinng to a sigle attribute and works

<xf:setvalue ref="instance('templateRefPoint')/attribute::Description" />

but if I try with

<xf:setvalue ref="instance('templateRefPoint')/attribute::*" />

OR

<xf:setvalue iterate="instance('templateRefPoint')/attribute::*" />

it doesn t work why???
thanks
Daniele

2011/4/6 daniele ippoliti <[hidden email]>
Hello thanks for your suggestions

My need is to clean a template that is composed by only one node with all attributes setted and I would like to set NULL all the attribute values

I have tried to do something like this

<xf:setvalue ref="instance('templateRefPoint')[attribute::*]"  value=""/>

but I don't receive the behaviour that I expected


thanks for your help
Daniele


2011/4/6 Erik Bruchez <[hidden email]>
Daniele,

You could use two instances:

* a clean template that you never modify (this could even be readonly
with xxforms:readonly="true")
* a "work in progress" template with the data filled by the user

Or you could clean the template after usage, for example with:

<xf:setvalue xxforms:iterate="instance('template')//*[not(*)]" ref="."/>

The above will blank all the elements that do not have children elements.

-Erik

On Tue, Apr 5, 2011 at 6:54 AM, daniele ippoliti <[hidden email]> wrote:
> Hello
>
> I have a table defined with the repeat structure and I would like to add a
> new rows.
>
> To do this I need to show to the user some new fields that he has to fill, I
> have done the followuing steps:
> 1) I have created an instance for the template "empty" that I would like to
> add to the XML file
> 2) I have created a table based on the elements on the XML file
> 3) when user click on Add new row I show to the user some fields to fill
> (these fields are linked to the template in order to keep the informations
> inserted by the user)
> 4) when the user has filled all the fields and he clicks on OK button I
> insert the structure on the XML file and I copy the value from the template
> to the new structure inserted.
>
> the problem is that if the user tries to add a new field I have the template
> dirty of the previous data so I'll show to the user the form with the last
> inserted element but I wouldn't to have this behaviour
>
> do you have any idea???
>
> Daniele
>
> --
> 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





--
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: Re: clean a template after an insert...

Erik Bruchez
Administrator
Use xxforms:iterate, not iterate.

Also use // to reach all descendant attributes.

<xf:setvalue xxforms:iterate="instance('templateRefPoint')//@*" />

-Erik

On Wed, Apr 6, 2011 at 2:31 AM, daniele ippoliti <[hidden email]> wrote:

> I have tried accessinng to a sigle attribute and works
>
> <xf:setvalue ref="instance('templateRefPoint')/attribute::Description" />
>
> but if I try with
>
> <xf:setvalue ref="instance('templateRefPoint')/attribute::*" />
>
> OR
>
> <xf:setvalue iterate="instance('templateRefPoint')/attribute::*" />
>
> it doesn t work why???
> thanks
> Daniele
>
> 2011/4/6 daniele ippoliti <[hidden email]>
>>
>> Hello thanks for your suggestions
>>
>> My need is to clean a template that is composed by only one node with all
>> attributes setted and I would like to set NULL all the attribute values
>>
>> I have tried to do something like this
>>
>> <xf:setvalue ref="instance('templateRefPoint')[attribute::*]"  value=""/>
>>
>> but I don't receive the behaviour that I expected
>>
>>
>> thanks for your help
>> Daniele
>>
>> 2011/4/6 Erik Bruchez <[hidden email]>
>>>
>>> Daniele,
>>>
>>> You could use two instances:
>>>
>>> * a clean template that you never modify (this could even be readonly
>>> with xxforms:readonly="true")
>>> * a "work in progress" template with the data filled by the user
>>>
>>> Or you could clean the template after usage, for example with:
>>>
>>> <xf:setvalue xxforms:iterate="instance('template')//*[not(*)]" ref="."/>
>>>
>>> The above will blank all the elements that do not have children elements.
>>>
>>> -Erik
>>>
>>> On Tue, Apr 5, 2011 at 6:54 AM, daniele ippoliti <[hidden email]>
>>> wrote:
>>> > Hello
>>> >
>>> > I have a table defined with the repeat structure and I would like to
>>> > add a
>>> > new rows.
>>> >
>>> > To do this I need to show to the user some new fields that he has to
>>> > fill, I
>>> > have done the followuing steps:
>>> > 1) I have created an instance for the template "empty" that I would
>>> > like to
>>> > add to the XML file
>>> > 2) I have created a table based on the elements on the XML file
>>> > 3) when user click on Add new row I show to the user some fields to
>>> > fill
>>> > (these fields are linked to the template in order to keep the
>>> > informations
>>> > inserted by the user)
>>> > 4) when the user has filled all the fields and he clicks on OK button I
>>> > insert the structure on the XML file and I copy the value from the
>>> > template
>>> > to the new structure inserted.
>>> >
>>> > the problem is that if the user tries to add a new field I have the
>>> > template
>>> > dirty of the previous data so I'll show to the user the form with the
>>> > last
>>> > inserted element but I wouldn't to have this behaviour
>>> >
>>> > do you have any idea???
>>> >
>>> > Daniele
>>> >
>>> > --
>>> > 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
>>>
>>
>
>
>
> --
> 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