Re: dynamic XMLForm taking inout data from previous steps?

2002-10-31 Thread Ivelin Ivanov

Actually what you describe is the correct behavior of repeat.
If you look at the W3C XForms spec, it says that repeat will render the
nodeset which satisfies the XPath selector.

How many boxes do you expect to render?
One solution is to change the getter method for the languages property, so
that it pads the array with blank entries to match the value of
descriptionsNumber if the array's current size() is less than that of
descriptionsNumber .


Ivelin


- Original Message -
From: Josema Alonso [EMAIL PROTECTED]
To: Cocoon-Users [EMAIL PROTECTED]
Sent: Tuesday, October 29, 2002 4:07 PM
Subject: Re: dynamic XMLForm taking inout data from previous steps?


  I tried to figure how the xf:repeat and xf:group tags work, maybe that's
 the
  way to go. Still not much info about it anyway.
 I think I've almost got it:
 xf:repeat nodeset=languages[position() lt;= /descriptionsNumber]
 id=descriptionLangs
 xf:textbox ref=. class=info
 xf:captionLanguage (code):/xf:caption
 /xf:textbox
 /xf:repeat

 And I have in the model bean:
 ...
 private int descriptionsNumber = 1;
 private List languages = new ArrayList();
 ...
 public InsertBean () {
 initLanguages();
 }

 public void initLanguages() {
 languages.add(en);
 languages.add(es);
 }
 ...

 And the 'descriptionsNumber' is filled on a previous step in the form
 wizard.
 But...oh yes, there's a but, I can only generate in the repeat as many
input
 boxes as elements the 'languages' ArrayList have. It seems that it doesn't
 show more than two of them no matter the number I put to fill the
 'descriptionsNumber' field. If I put 1, it shows just one field, if I put
2,
 it shows two fields, if I put three or more, it only shows two anyway. I
 guess that's because the ArrayList only have two elements and the rest of
 the calls return null.
 Is there a workaround?
 I think I'll try looking at the source code of the transformer...

 Best.



 -
 Please check that your question  has not already been answered in the
 FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: dynamic XMLForm taking inout data from previous steps?

2002-10-31 Thread Josema Alonso
...
 How many boxes do you expect to render?
 One solution is to change the getter method for the languages property, so
 that it pads the array with blank entries to match the value of
 descriptionsNumber if the array's current size() is less than that of
 descriptionsNumber .

It seems you were reading my mind ;-)
I just coded that a few hours ago and it works.

Thanks a lot.

ps: I'm starting a new thread about my concerns using XMLForm with
Xindice...I'm almost there, but would need a but of help :-)



-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




dynamic XMLForm taking inout data from previous steps?

2002-10-29 Thread Josema Alonso
Hi, all.

This is what I'm trying to do:
1.- I want to have a form similar to the wizard sample. In the first page I
want to have a input box that can hold a number and another for a name.
Something like this:
?xml version=1.0?
document xmlns:xf=http://xml.apache.org/cocoon/xmlform/2002;
xf:form id=form-insert view=product action=insert
method=POST
xf:captionNew Product/xf:caption
error
xf:violations class=error/
/error
xf:textbox ref=/productName
xf:captionProduct Name:/xf:caption
xf:violations class=error/
/xf:textbox
xf:textbox ref=/descriptions
xf:captionNumber of Descriptions/xf:caption
xf:help (one for each language you'll choose later)/xf:help
xf:violations class=error/
/xf:textbox
xf:submit id=prev class=button
xf:captionPrev/xf:caption
xf:hintGo to previous page/xf:hint
/xf:submit
xf:submit id=next class=button
xf:captionNext/xf:caption
xf:hintGo to next page/xf:hint
/xf:submit
/xf:form
/document

2.- Now I want to query the form so I can get the number the user put in the
'descriptions' field. Then I could show him the number of boxes she
requested at the previous page, so she could fill descriptions for a product
for the number of languages she wanted in step 1.

I tried to figure how the xf:repeat and xf:group tags work, maybe that's the
way to go. Still not much info about it anyway.

Ivelin, anyone...is this possible? If so, how could I make it work?
I'm having a VERY hard time making XMLForms work, I'm still unsure if they
derserve the time. Please, convince me, I really want to keep on trying, but
I'm sooo tired...
I know Javascript validation is not that good, but I have a strong
Javascript background and I think I could code something similar quicker.

Thanks in advance.


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: dynamic XMLForm taking inout data from previous steps?

2002-10-29 Thread Josema Alonso
 I tried to figure how the xf:repeat and xf:group tags work, maybe that's
the
 way to go. Still not much info about it anyway.
I think I've almost got it:
xf:repeat nodeset=languages[position() lt;= /descriptionsNumber]
id=descriptionLangs
xf:textbox ref=. class=info
xf:captionLanguage (code):/xf:caption
/xf:textbox
/xf:repeat

And I have in the model bean:
...
private int descriptionsNumber = 1;
private List languages = new ArrayList();
...
public InsertBean () {
initLanguages();
}

public void initLanguages() {
languages.add(en);
languages.add(es);
}
...

And the 'descriptionsNumber' is filled on a previous step in the form
wizard.
But...oh yes, there's a but, I can only generate in the repeat as many input
boxes as elements the 'languages' ArrayList have. It seems that it doesn't
show more than two of them no matter the number I put to fill the
'descriptionsNumber' field. If I put 1, it shows just one field, if I put 2,
it shows two fields, if I put three or more, it only shows two anyway. I
guess that's because the ArrayList only have two elements and the rest of
the calls return null.
Is there a workaround?
I think I'll try looking at the source code of the transformer...

Best.



-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]