You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dimitrios Sferopoulos <d....@ed.ac.uk> on 2010/06/08 15:46:40 UTC

add textfields to form dynamically

Hi all,

I want users of an advanced search page to be able to add textfields to 
a form dynamically. There should be a plus sign button which when each 
time it's pressed there should be added 2 dropdowns and a textfield.

I have created an advancedSearchFields class with getters and setters.

public class AdvancedSearchFields {

    private String boolDropdownIdValue;   
    private String searchTextFieldIdValue;   
    private String dropdownIdValue;
}


When I try to do the following from within the AdvancedSearch.tml I get 
an error.

<tr t:type="loop" t:source="extraFields" t:value="advSearchFieldItem">
                    <td><t:select 
t:id="*advSearchFieldItem.boolDropdownIdValue*" 
value="*advSearchFieldItem.boolDropdownIdValue*" blankLabel="and" 
model="literal:OR=or,NOT=not" /></td>
                   <td><input t:type="textfield" 
t:value="*advSearchFieldItem.searchTextFieldIdValue*" 
t:id="*advSearchFieldItem.searchTextFieldIdValue*" type="text" 
name="*advSearchFieldItem.searchTextFieldIdValue*" class="searchfield" 
/></td>
<td>in <t:select t:id="*advSearchFieldItem.dropdownIdValue*" 
value="*advSearchFieldItem.dropdownIdValue*" blankLabel="All Fields" 
model="literal:cat_ref_code=Catalogue: Reference code, 
cat_title=Catalogue: Title"/></td>
</tr>   

_Error:_
Failure parsing template context:AdvancedSearch.tml: Component id 
'advSearchFieldItem.boolDropdownIdValue' is not valid; component ids 
must be valid Java identifiers: start with a letter, and consist of 
letters, numbers and underscores.

It seems that there seems to not accept the *advSearchFieldItem.* *that 
I have entered as ids and values.
Any ideas on how to solve this? Or another way of doing the same thing?

Dimitrios


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: add textfields to form dynamically

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 08 Jun 2010 11:22:03 -0300, Dimitrios Sferopoulos  
<d....@ed.ac.uk> wrote:

>> You can't use dots for Tapestry t:id's nor HTML ids. Use an underscore  
>> or hyphen instead.
> There has to be a dot there as it refers to dynamic content retrieved  
> from an arraylist of objects.

You can use a dot in the value parameter, but not in the t:id. t:id is not  
a parameter, it's the component id.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: add textfields to form dynamically

Posted by Dimitrios Sferopoulos <d....@ed.ac.uk>.
Thiago H. de Paula Figueiredo wrote:
> On Tue, 08 Jun 2010 10:46:40 -0300, Dimitrios Sferopoulos 
> <d....@ed.ac.uk> wrote:
>
>> Hi all,
>
> Hi!
>
>> I want users of an advanced search page to be able to add textfields 
>> to a form dynamically. There should be a plus sign button which when 
>> each time it's pressed there should be added 2 dropdowns and a 
>> textfield.
>
> Why don't you use the AjaxFormLoop?
>
I don't want the functionality of the page to be javascript dependent.
>> It seems that there seems to not accept the *advSearchFieldItem.* 
>> *that I have entered as ids and values.
>> Any ideas on how to solve this? Or another way of doing the same thing?
>
> You can't use dots for Tapestry t:id's nor HTML ids. Use an underscore 
> or hyphen instead.
>
There has to be a dot there as it refers to dynamic content retrieved 
from an arraylist of objects.


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: add textfields to form dynamically

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 08 Jun 2010 10:46:40 -0300, Dimitrios Sferopoulos  
<d....@ed.ac.uk> wrote:

> Hi all,

Hi!

> I want users of an advanced search page to be able to add textfields to  
> a form dynamically. There should be a plus sign button which when each  
> time it's pressed there should be added 2 dropdowns and a textfield.

Why don't you use the AjaxFormLoop?

> It seems that there seems to not accept the *advSearchFieldItem.* *that  
> I have entered as ids and values.
> Any ideas on how to solve this? Or another way of doing the same thing?

You can't use dots for Tapestry t:id's nor HTML ids. Use an underscore or  
hyphen instead.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org