xforms:repeat in textarea possible?

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

xforms:repeat in textarea possible?

ilango_g
Hi
Is it possible to have a repeat structure inside a textarea control. I would like to be able to do this so that I can view a table that grows or shrinks inside the textarea. In addition is there any way to format text neatly inside a text area?

For example what I would like to do is to have something like this:

<xforms:textarea ref="instance('taskoutput')/fe:my-textarea"
                                             class="x-large-textarea" appearance="xxforms:autosize" incremental="true">
                                <xforms:label class="test-label">DESCRIPTION</xforms:label>

                               <xhtml:table class="ChargeCodeTable">
                                <xhtml:tr>
                                    <xhtml:th>Ti</xhtml:th>
                                    <xhtml:th>Se</xhtml:th>
                                    <xhtml:th>Sub Sec</xhtml:th>
                                </xhtml:tr>
                               
                                    <xforms:repeat id="c-repeat" nodeset="instance('taskoutput')/fe:charges-r/fe:charge-r[position() &lt; last()]">

                  ....................
                  ...............................
                                 

                            </xforms:textarea>


I read the XForm spec and it says that textarea cannot bind to element nodes that have element children. Does that mean that I cannot embed a repeat structure or even a table?

 
Reply | Threaded
Open this post in threaded view
|

Re: re peating rows in textarea

fl.schmitt(ops-users)
hi someperson,

to edit rich text content including tables, you could use the HTML area
[1]. Orbeon Forms uses the fckeditor [2] as XHTML editor component [2a].

I think there's no way to use xforms controls or elements _inside_the_
_HTML_area_ to create xforms repeats. *But* you can use the serialize()
function to bind the htmlarea to a element that has children; it's the
same as using HTML as the content of a xforms:hint or xforms:help [3].
Practically, the reference points to a string representation (with the
XHTML code escaped) of the child nodes.

Using the serialize() function to serialize the children on-the-fly,
you're able to modify the child nodes (XHTML content) as you can do this
with every other instance node. However, if you make the content
editable directly *and* via xforms controls, this may result in strange
/ unpredictable results. The user could delete the entire table, so the
xforms:repeat / insert will fail eventually. Personally, i wouldn't
provide both ways to edit the content at the same time. Instead, i would
separate the content in a "free-text" part solely editable using the
HTML area (or simple textarea), and another table part implemented using
xforms:repeat.

[1] http://www.orbeon.com/ops/xforms-html-area/
[2] http://www.fckeditor.net/
[2a] By default, only part of the available features offered by
fckeditor is shown in the toolbar. You can modify this by editing the
sources in orbeon-resources-public.jar.
[3]
http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-label-alert-help-hint

HTH
florian


--
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 peating rows in textarea

Erik Bruchez
Administrator
In reply to this post by ilango_g
> Is it possible to have a repeat structure inside a textarea control.  

> I would
> like to be able to do this so that I can view a table that grows or  
> shrinks
> inside the textarea. In addition is there any way to format text  
> neatly
> inside a text area?
>
> For example what I would like to do is to have something like this:
>
> <xforms:textarea ref="instance('taskoutput')/fe:my-textarea"
>                                             class="x-large-textarea"
> appearance="xxforms:autosize" incremental="true">
>                                <xforms:label
> class="test-label">DESCRIPTION</xforms:label>
>
>                               <xhtml:table class="ChargeCodeTable">
>                               <xhtml:tr>
>                                     <xhtml:th>Ti</xhtml:th>
>                                     <xhtml:th>Se</xhtml:th>
>                                     <xhtml:th>Sub Sec</xhtml:th>
>                                 </xhtml:tr>
>
>                                     <xforms:repeat id="c-repeat"
> nodeset="instance('taskoutput')/fe:charges-r/fe:charge-r[position()  
> &lt;
> last()]">
>
>                  ....................
>                  ...............................
>
>
>                            </xforms:textarea>
>
>
> I read the XForm spec and it says that textarea cannot bind to  
> element nodes
> that have element children. Does that mean that I cannot embed a  
> repeat
> structure or even a table?
All XForms controls, with the exception of selection controls which  
use xforms:copy (which we, hum, don't yet support) always:

* Bind to an element or attribute
* If bound to an element, then that element cannot contain complex  
content (i.e. it contains just text)

The XForms Working Group has clarified this in XForms 1.1. This is not  
to say that in the future XForms won't support binding to complex  
content in the future, just that as of now it is not allowed for built-
in controls.

But your question above seems a little different, as you show markup  
that embeds a table within the xforms:textarea control itself. Inline  
content like this is not allowed for any XForms control. There is only  
a limited set of elements which you can embed in a control, like label|
hint|help|alert|itemset|choices|item.

But you could use the HTML area, i.e. <xforms:textarea mediatype="text/
html">, and deal with HTML in the bound node. Note that the HTML has  
to be escaped in this case: it still cannot be complex content. See  
this for example:

   http://www.orbeon.com/ops/xforms-html-area/

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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 peating rows in textarea

ilango_g
In reply to this post by fl.schmitt(ops-users)
Actually I have given more thought to what I would like to do with the text in my text area. I decided I just want them neatly presented. One block of text would be added first and then if the user selects a different value in the dropdown above this text area, a different block of text should be written inside the box. I only want that the text is neatly presented.
After your suggestion, I want to drop the idea of using a repeat.

I think even the FCK editor is not required because I only want the text neatly presented to the user.
Do you have any thoughts on that?

Right now, the text is not at all user-friendly.
fs(ops-users) wrote
hi someperson,

to edit rich text content including tables, you could use the HTML area
[1]. Orbeon Forms uses the fckeditor [2] as XHTML editor component [2a].

I think there's no way to use xforms controls or elements _inside_the_
_HTML_area_ to create xforms repeats. *But* you can use the serialize()
function to bind the htmlarea to a element that has children; it's the
same as using HTML as the content of a xforms:hint or xforms:help [3].
Practically, the reference points to a string representation (with the
XHTML code escaped) of the child nodes.

Using the serialize() function to serialize the children on-the-fly,
you're able to modify the child nodes (XHTML content) as you can do this
with every other instance node. However, if you make the content
editable directly *and* via xforms controls, this may result in strange
/ unpredictable results. The user could delete the entire table, so the
xforms:repeat / insert will fail eventually. Personally, i wouldn't
provide both ways to edit the content at the same time. Instead, i would
separate the content in a "free-text" part solely editable using the
HTML area (or simple textarea), and another table part implemented using
xforms:repeat.

[1] http://www.orbeon.com/ops/xforms-html-area/
[2] http://www.fckeditor.net/
[2a] By default, only part of the available features offered by
fckeditor is shown in the toolbar. You can modify this by editing the
sources in orbeon-resources-public.jar.
[3]
http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-label-alert-help-hint

HTH
florian


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

Re: Re: re peating rows in textarea

fl.schmitt(ops-users)
hi someperson,

> I think even the FCK editor is not required because I only want the text
> neatly presented to the user.
> Do you have any thoughts on that?

yes - if it's sufficient to show the content and there's no need to edit it
manually/directly, you could use a xforms:output element with "text/html" as
mediatype:

<xforms:output mediatype="text/html"
value="xxforms:serialize(instance('resources')/help/number/*, 'html')"/>

More examples:
http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-label-alert-help-hint

This is shown also in the HTML area Example:
http://www.orbeon.com/ops/source-viewer/xforms-html-area/

HTH
florian



--
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
|

should I retain xforms:setValue

ilango_g
Hi
Right now this is the code I have for the textarea.

----------
<xforms:textarea ref="instance('taskoutput')/fe:c-description-textarea"
                                             class="x-large-textarea" appearance="xxforms:autosize" incremental="true">
                                <xforms:label class="test-label">DESCRIPTION</xforms:label>
                               
                                <xforms:setvalue ev:event="DOMActivate"
                                                 ref="instance('taskoutput')/fe:c-description-textarea"
                                              value="instance('c-instance')/fe:c/fe:sections/fe:section/fe:subsections/fe:subsection/fe:c-description[../../../fe:section-name=instance('section-chosen')]"/>
                                -->
</xforms:textarea>

-------------

Should I place the following code after the xforms:setvalue

as:
<xforms:output mediatype="text/html"
value="xxforms:serialize(instance('resources')/help/number/*, 'html')"/>

putting the right instance values in that?



fs(ops-users) wrote
hi someperson,

> I think even the FCK editor is not required because I only want the text
> neatly presented to the user.
> Do you have any thoughts on that?

yes - if it's sufficient to show the content and there's no need to edit it
manually/directly, you could use a xforms:output element with "text/html" as
mediatype:

<xforms:output mediatype="text/html"
value="xxforms:serialize(instance('resources')/help/number/*, 'html')"/>

More examples:
http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-label-alert-help-hint

This is shown also in the HTML area Example:
http://www.orbeon.com/ops/source-viewer/xforms-html-area/

HTH
florian



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

Re: should I retain xforms:setValue

fl.schmitt(ops-users)
hi ilan,

> Should I place the following code after the xforms:setvalue

> as:
> <xforms:output mediatype="text/html"
> value="xxforms:serialize(instance('resources')/help/number/*, 'html')"/>
>
> putting the right instance values in that?

you could (and i think have to) replace the complete xforms:textarea by
the xforms:output. The setvalue isn't required because the xforms:output
is updated when the content of the referenced node changes.

HTH
florian



--
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: should I retain xforms:setValue

ilango_g
Hi
Actually the reason for my retaining the textarea idea is to be able to have as many records written  using xforms:output as there are records in my repeat structure. This (textarea) or body of neatly formatted text  is going to grow and have a scrollbar(?) and allow the text inside to be read.
Or is there a better way to display this growing body of text by say, getting rid of the textarea and still have a scroller with xforms:output?


fs(ops-users) wrote
hi ilan,

> Should I place the following code after the xforms:setvalue

> as:
> <xforms:output mediatype="text/html"
> value="xxforms:serialize(instance('resources')/help/number/*, 'html')"/>
>
> putting the right instance values in that?

you could (and i think have to) replace the complete xforms:textarea by
the xforms:output. The setvalue isn't required because the xforms:output
is updated when the content of the referenced node changes.

HTH
florian



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

Re: Re: should I retain xforms:setValue

fl.schmitt(ops-users)
hi ilan,

> Actually the reason for my retaining the textarea idea is to be able to have
> as many records written  using xforms:output as there are records in my
> repeat structure. This (textarea) or body of neatly formatted text  is going
> to grow and have a scrollbar(?) and allow the text inside to be read.
> Or is there a better way to display this growing body of text by say,
> getting rid of the textarea and still have a scroller with xforms:output?

You could use a xhtml:div around the xforms:output and set the size of
that div by css. If the content needs more space than allocated by the
div element, you could apply the css overflow property (overflow=scroll)
to the div to add scrollbars to the div box. I think this is a
"lightweight solution" that may be sufficient for your needs.


HTH
florian


--
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: should I retain xforms:setValue

Erik Bruchez
Administrator
Absolutely, I was going to suggest something like this. You just have  
to make sure you test your CSS with multiple browsers (in particular  
with IE 6, which has terrible CSS support).

-Erik

On Mar 25, 2008, at 2:47 AM, Florian Schmitt wrote:

> hi ilan,
>
>> Actually the reason for my retaining the textarea idea is to be  
>> able to have
>> as many records written  using xforms:output as there are records  
>> in my
>> repeat structure. This (textarea) or body of neatly formatted text  
>> is going
>> to grow and have a scrollbar(?) and allow the text inside to be read.
>> Or is there a better way to display this growing body of text by say,
>> getting rid of the textarea and still have a scroller with  
>> xforms:output?
>
> You could use a xhtml:div around the xforms:output and set the size  
> of that div by css. If the content needs more space than allocated  
> by the div element, you could apply the css overflow property  
> (overflow=scroll) to the div to add scrollbars to the div box. I  
> think this is a "lightweight solution" that may be sufficient for  
> your needs.
>
>
> HTH
> florian
>
> --
> 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
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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