You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Мария Григорьева <ma...@gmail.com> on 2008/08/01 18:56:23 UTC
pass repeater from database to the form
I'm trying to pass the parameters from the database to the repeater in the
form.
var repeater=form.getChild("test");
for (var i = 0; i < comp_in_composition.size(); i++) {
var row = repeater.getRow(i);
var type = row.getChild("type");
var amount = row.getChild("amount");
var select = row.getChild("select");
type.setValue(comp_in_composition.get(i).get("type"));
amount.setValue(comp_in_composition.get(i).get("amount"));
select.setValue(false);
}
But, I've got an exception: java.lang.IndexOutOfBoundsException: Index: 1,
Size: 1
What's the problem? How to pass this params to the form repeater?
Re: pass repeater from database to the form
Posted by Magsend <ma...@gmail.com>.
Thanks a lot, Ralph!!!
It works now!!!
Ralph Rauscher-2 wrote:
>
> Use
>
> var row = repeater.addRow();
>
> instead of
>
> var row = repeater.getRow(i);
>
>
> Мария Григорьева wrote:
>>
>> I'm trying to pass the parameters from the database to the repeater in
>> the form.
>>
>>
>>
>> var repeater=form.getChild("test");
>>
>> for (var i = 0; i < comp_in_composition.size(); i++) {
>>
>> var row = repeater.getRow(i);
>>
>> var type = row.getChild("type");
>>
>> var amount = row.getChild("amount");
>>
>> var select = row.getChild("select");
>>
>>
>> type.setValue(comp_in_composition.get(i).get("type"));
>>
>>
>> amount.setValue(comp_in_composition.get(i).get("amount"));
>>
>> select.setValue(false);
>>
>> }
>>
>>
>>
>> But, I've got an exception: java.lang.IndexOutOfBoundsException:
>> Index: 1, Size: 1
>>
>>
>>
>> What's the problem? How to pass this params to the form repeater?
>>
>
>
>
>
--
View this message in context: http://www.nabble.com/pass-repeater-from-database-to-the-form-tp18778753p18780735.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: pass repeater from database to the form
Posted by Magsend <ma...@gmail.com>.
Sorry, again... Stupid question... :)
I've understood that ---
row.getChild("type").setValue(comp_in_composition.get(i).get("type"));
--- is the passing params to the form... So I don't need formMap.put()... :)
Magsend wrote:
>
> But now, I have another problem...
> I need to pass the repeater to the form, so I wrote:
>
> var repeater = form.getChild("test");
> for (var i = 0; i < comp_in_composition.size(); i++) {
> var row = repeater.addRow(i);
> row.getChild("type").setValue(comp_in_composition.get(i).get("type"));
>
> row.getChild("amount").setValue(comp_in_composition.get(i).get("amount"));
> row.getChild("select").setValue(false);
> }
>
> formMap.put("test", repeater);
>
> "test" - is the id of the repeater in fd:repeater
>
> But, I've got mistake: java.lang.IllegalArgumentException: A repeater
> cannot be filled with Repeater 'test'
>
> How to pass it to the form???
>
>
> Magsend wrote:
>>
>> I've already answer my own question:
>> Here is my code:
>>
>> for (var i = 0; i < comp_in_composition.size(); i++) {
>> var row = repeater.addRow(i);
>> row.getChild("type").setValue(comp_in_composition.get(i).get("type"));
>>
>> row.getChild("amount").setValue(comp_in_composition.get(i).get("amount"));
>> row.getChild("select").setValue(false);
>> }
>>
>>
>>
>> Magsend wrote:
>>>
>>> I'm using FOR to pass the params to the repeater:
>>>
>>> for (var i = 0; i < comp_in_composition.size(); i++) {
>>> var row = repeater.addRow(i);
>>> .........
>>> }
>>>
>>> How to create child nodes for the "row" element?
>>>
>>> I found addWidget() procedure in API, but it doesn't work:
>>> For example: row.addWidget("type");
>>>
>>>
>>>
>>>
>>> Ralph Rauscher-2 wrote:
>>>>
>>>> Use
>>>>
>>>> var row = repeater.addRow();
>>>>
>>>> instead of
>>>>
>>>> var row = repeater.getRow(i);
>>>>
>>>>
>>>> Мария Григорьева wrote:
>>>>>
>>>>> I'm trying to pass the parameters from the database to the repeater in
>>>>> the form.
>>>>>
>>>>>
>>>>>
>>>>> var repeater=form.getChild("test");
>>>>>
>>>>> for (var i = 0; i < comp_in_composition.size(); i++) {
>>>>>
>>>>> var row = repeater.getRow(i);
>>>>>
>>>>> var type = row.getChild("type");
>>>>>
>>>>> var amount = row.getChild("amount");
>>>>>
>>>>> var select = row.getChild("select");
>>>>>
>>>>>
>>>>> type.setValue(comp_in_composition.get(i).get("type"));
>>>>>
>>>>>
>>>>> amount.setValue(comp_in_composition.get(i).get("amount"));
>>>>>
>>>>> select.setValue(false);
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> But, I've got an exception: java.lang.IndexOutOfBoundsException:
>>>>> Index: 1, Size: 1
>>>>>
>>>>>
>>>>>
>>>>> What's the problem? How to pass this params to the form repeater?
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/pass-repeater-from-database-to-the-form-tp18778753p18781881.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: pass repeater from database to the form
Posted by Magsend <ma...@gmail.com>.
But now, I have another problem...
I need to pass the repeater to the form, so I wrote:
var repeater = form.getChild("test");
for (var i = 0; i < comp_in_composition.size(); i++) {
var row = repeater.addRow(i);
row.getChild("type").setValue(comp_in_composition.get(i).get("type"));
row.getChild("amount").setValue(comp_in_composition.get(i).get("amount"));
row.getChild("select").setValue(false);
}
formMap.put("test", repeater);
"test" - is the id of the repeater in fd:repeater
But, I've got mistake: java.lang.IllegalArgumentException: A repeater cannot
be filled with Repeater 'test'
How to pass it to the form???
Magsend wrote:
>
> I've already answer my own question:
> Here is my code:
>
> for (var i = 0; i < comp_in_composition.size(); i++) {
> var row = repeater.addRow(i);
> row.getChild("type").setValue(comp_in_composition.get(i).get("type"));
>
> row.getChild("amount").setValue(comp_in_composition.get(i).get("amount"));
> row.getChild("select").setValue(false);
> }
>
>
>
> Magsend wrote:
>>
>> I'm using FOR to pass the params to the repeater:
>>
>> for (var i = 0; i < comp_in_composition.size(); i++) {
>> var row = repeater.addRow(i);
>> .........
>> }
>>
>> How to create child nodes for the "row" element?
>>
>> I found addWidget() procedure in API, but it doesn't work:
>> For example: row.addWidget("type");
>>
>>
>>
>>
>> Ralph Rauscher-2 wrote:
>>>
>>> Use
>>>
>>> var row = repeater.addRow();
>>>
>>> instead of
>>>
>>> var row = repeater.getRow(i);
>>>
>>>
>>> Мария Григорьева wrote:
>>>>
>>>> I'm trying to pass the parameters from the database to the repeater in
>>>> the form.
>>>>
>>>>
>>>>
>>>> var repeater=form.getChild("test");
>>>>
>>>> for (var i = 0; i < comp_in_composition.size(); i++) {
>>>>
>>>> var row = repeater.getRow(i);
>>>>
>>>> var type = row.getChild("type");
>>>>
>>>> var amount = row.getChild("amount");
>>>>
>>>> var select = row.getChild("select");
>>>>
>>>>
>>>> type.setValue(comp_in_composition.get(i).get("type"));
>>>>
>>>>
>>>> amount.setValue(comp_in_composition.get(i).get("amount"));
>>>>
>>>> select.setValue(false);
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> But, I've got an exception: java.lang.IndexOutOfBoundsException:
>>>> Index: 1, Size: 1
>>>>
>>>>
>>>>
>>>> What's the problem? How to pass this params to the form repeater?
>>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/pass-repeater-from-database-to-the-form-tp18778753p18781834.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: pass repeater from database to the form
Posted by Magsend <ma...@gmail.com>.
I've already answer my own question:
Here is my code:
for (var i = 0; i < comp_in_composition.size(); i++) {
var row = repeater.addRow(i);
row.getChild("type").setValue(comp_in_composition.get(i).get("type"));
row.getChild("amount").setValue(comp_in_composition.get(i).get("amount"));
row.getChild("select").setValue(false);
}
Magsend wrote:
>
> I'm using FOR to pass the params to the repeater:
>
> for (var i = 0; i < comp_in_composition.size(); i++) {
> var row = repeater.addRow(i);
> .........
> }
>
> How to create child nodes for the "row" element?
>
> I found addWidget() procedure in API, but it doesn't work:
> For example: row.addWidget("type");
>
>
>
>
> Ralph Rauscher-2 wrote:
>>
>> Use
>>
>> var row = repeater.addRow();
>>
>> instead of
>>
>> var row = repeater.getRow(i);
>>
>>
>> Мария Григорьева wrote:
>>>
>>> I'm trying to pass the parameters from the database to the repeater in
>>> the form.
>>>
>>>
>>>
>>> var repeater=form.getChild("test");
>>>
>>> for (var i = 0; i < comp_in_composition.size(); i++) {
>>>
>>> var row = repeater.getRow(i);
>>>
>>> var type = row.getChild("type");
>>>
>>> var amount = row.getChild("amount");
>>>
>>> var select = row.getChild("select");
>>>
>>>
>>> type.setValue(comp_in_composition.get(i).get("type"));
>>>
>>>
>>> amount.setValue(comp_in_composition.get(i).get("amount"));
>>>
>>> select.setValue(false);
>>>
>>> }
>>>
>>>
>>>
>>> But, I've got an exception: java.lang.IndexOutOfBoundsException:
>>> Index: 1, Size: 1
>>>
>>>
>>>
>>> What's the problem? How to pass this params to the form repeater?
>>>
>>
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/pass-repeater-from-database-to-the-form-tp18778753p18781804.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: pass repeater from database to the form
Posted by Magsend <ma...@gmail.com>.
I'm using FOR to pass the params to the repeater:
for (var i = 0; i < comp_in_composition.size(); i++) {
var row = repeater.addRow(i);
.........
}
How to create child nodes for the "row" element?
I found addWidget() procedure in API, but it doesn't work:
For example: row.addWidget("type");
Ralph Rauscher-2 wrote:
>
> Use
>
> var row = repeater.addRow();
>
> instead of
>
> var row = repeater.getRow(i);
>
>
> Мария Григорьева wrote:
>>
>> I'm trying to pass the parameters from the database to the repeater in
>> the form.
>>
>>
>>
>> var repeater=form.getChild("test");
>>
>> for (var i = 0; i < comp_in_composition.size(); i++) {
>>
>> var row = repeater.getRow(i);
>>
>> var type = row.getChild("type");
>>
>> var amount = row.getChild("amount");
>>
>> var select = row.getChild("select");
>>
>>
>> type.setValue(comp_in_composition.get(i).get("type"));
>>
>>
>> amount.setValue(comp_in_composition.get(i).get("amount"));
>>
>> select.setValue(false);
>>
>> }
>>
>>
>>
>> But, I've got an exception: java.lang.IndexOutOfBoundsException:
>> Index: 1, Size: 1
>>
>>
>>
>> What's the problem? How to pass this params to the form repeater?
>>
>
>
>
>
--
View this message in context: http://www.nabble.com/pass-repeater-from-database-to-the-form-tp18778753p18781627.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: pass repeater from database to the form
Posted by Ralph Rauscher <rr...@blue-elephant-systems.com>.
Use
var row = repeater.addRow();
instead of
var row = repeater.getRow(i);
Мария Григорьева wrote:
>
> I'm trying to pass the parameters from the database to the repeater in
> the form.
>
>
>
> var repeater=form.getChild("test");
>
> for (var i = 0; i < comp_in_composition.size(); i++) {
>
> var row = repeater.getRow(i);
>
> var type = row.getChild("type");
>
> var amount = row.getChild("amount");
>
> var select = row.getChild("select");
>
>
> type.setValue(comp_in_composition.get(i).get("type"));
>
>
> amount.setValue(comp_in_composition.get(i).get("amount"));
>
> select.setValue(false);
>
> }
>
>
>
> But, I've got an exception: java.lang.IndexOutOfBoundsException:
> Index: 1, Size: 1
>
>
>
> What's the problem? How to pass this params to the form repeater?
>