You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Vu Hong Thuan <th...@gmail.com> on 2008/10/25 12:16:15 UTC

Why length field "name" of entity is not match to textbox size?

Hi,
I'm a newbie in ofbiz. I have a question.
The length of the entity field whose type is "name" is 100. By when is
rendered as a textbox in form, the size of text box is 40.
I really don't know about the mismatch in size of file type and of text-box
form input.
Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But in
the entity.config, type of GroupName field is "name" type. And length of
"name" type is 100.
How can I change the size of text-box of "name"-type entity field to 100?

Thank for any suggestion.

-- 
Vũ Hồng Thuận
Công ty Phần mềm và Truyền thông Việt Nam, NAMMEDIA, INC.
Email: thuanvh@nammedia.com
Web: http://www.nammedia.com
ĐT: (84)-04-5680964 - Fax: (84)-04-5681083
DĐ: 0984328513

Vu Hong Thuan
Vietnam Software and Communication Company. NAMMEDIA. INC
Email: thuanvh@nammedia.com
Web: http://www.nammedia.com
Phone: (84)-04-5680964 - Fax: (84)-04-5681083
Mobile: (84)-984328513

Re: Why length field "name" of entity is not match to textbox size?

Posted by Vu Hong Thuan <th...@gmail.com>.
Hi Todor,
But, How can I change the length of text-box input always equals to the
length of textfield?
Thanks.

2008/10/25 Todor Spasov <ts...@iguanait.com>

> Hello Vu,
> You can change the maximum length of a text field by using the maxlength
> parameter. Here is an example:
>
> <field name="description" title="${uiLabelMap.CommonDescription}">
>    <text maxlength="100"/>
> </field>
>
> I hope this would help you.
> Regards,
> Todor.
>
> On Sat, 2008-10-25 at 17:16 +0700, Vu Hong Thuan wrote:
> > Hi,
> > I'm a newbie in ofbiz. I have a question.
> > The length of the entity field whose type is "name" is 100. By when is
> > rendered as a textbox in form, the size of text box is 40.
> > I really don't know about the mismatch in size of file type and of
> text-box
> > form input.
> > Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But
> in
> > the entity.config, type of GroupName field is "name" type. And length of
> > "name" type is 100.
> > How can I change the size of text-box of "name"-type entity field to 100?
> >
> > Thank for any suggestion.
> >
>
>


-- 
Vũ Hồng Thuận
Công ty Phần mềm và Truyền thông Việt Nam, NAMMEDIA, INC.
Email: thuanvh@nammedia.com
Web: http://www.nammedia.com
ĐT: (84)-04-5680964 - Fax: (84)-04-5681083
DĐ: 0984328513

Vu Hong Thuan
Vietnam Software and Communication Company. NAMMEDIA. INC
Email: thuanvh@nammedia.com
Web: http://www.nammedia.com
Phone: (84)-04-5680964 - Fax: (84)-04-5681083
Mobile: (84)-984328513

Re: Why length field "name" of entity is not match to textbox size?

Posted by Todor Spasov <ts...@iguanait.com>.
Hello Vu,
You can change the maximum length of a text field by using the maxlength
parameter. Here is an example:

<field name="description" title="${uiLabelMap.CommonDescription}">
    <text maxlength="100"/>
</field>

I hope this would help you.
Regards,
Todor.

On Sat, 2008-10-25 at 17:16 +0700, Vu Hong Thuan wrote:
> Hi,
> I'm a newbie in ofbiz. I have a question.
> The length of the entity field whose type is "name" is 100. By when is
> rendered as a textbox in form, the size of text box is 40.
> I really don't know about the mismatch in size of file type and of text-box
> form input.
> Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But in
> the entity.config, type of GroupName field is "name" type. And length of
> "name" type is 100.
> How can I change the size of text-box of "name"-type entity field to 100?
> 
> Thank for any suggestion.
> 


Re: Why length field "name" of entity is not match to textbox size?

Posted by BJ Freeman <bj...@free-man.net>.
all fields, unless it is a non-entity fields is defined in the db
definitions.
they can not be longer than the DB field, they are associated with.

Vu Hong Thuan sent the following on 10/25/2008 3:16 AM:
> Hi,
> I'm a newbie in ofbiz. I have a question.
> The length of the entity field whose type is "name" is 100. By when is
> rendered as a textbox in form, the size of text box is 40.
> I really don't know about the mismatch in size of file type and of text-box
> form input.
> Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But in
> the entity.config, type of GroupName field is "name" type. And length of
> "name" type is 100.
> How can I change the size of text-box of "name"-type entity field to 100?
> 
> Thank for any suggestion.
> 

Re: Why length field "name" of entity is not match to textbox size?

Posted by BJ Freeman <bj...@free-man.net>.
feel free to submit a patch in the jira
http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Contributors+Best+Practices
http://docs.ofbiz.org/display/OFBADMIN/Coding+Conventions
http://docs.ofbiz.org/display/OFBADMIN/Best+Practices+Guide

BJ Freeman sent the following on 10/25/2008 11:37 AM:
> put in a jira
> https://issues.apache.org/jira/browse/OFBIZ-2021
> 
> BJ Freeman sent the following on 10/25/2008 11:22 AM:
>> Ok yes you can define max less than the DB fieldtype.
>> looks like some reformating is done in
>> ModelFormField.java
>> about like 548.
>>            } else if ("name".equals(modelField.getType()) ||
>> "short-varchar".equals(modelField.getType())) {
>>                 ModelFormField.TextField textField = new
>> ModelFormField.TextField(ModelFormField.FieldInfo.SOURCE_AUTO_ENTITY, this);
>>                 textField.setSize(40);
>>                 textField.setMaxlength(Integer.valueOf(60));
>>                 this.setFieldInfo(textField);
>>
>>
>> Vu Hong Thuan sent the following on 10/25/2008 10:18 AM:
>>> Hi BJ,
>>> Thank for suggestion. But I find some interesting:
>>>
>>> 1. I'm using PostgreSQL. And in the file
>>> /framework/entity/fieldtype/fieldtypepostgres.xml, I find the following
>>> line:
>>> <field-type-def type="name" sql-type="VARCHAR(100)"
>>> java-type="String"></field-type-def>
>>> That means length of "type=name" field is equal to varchar(100) in postgres.
>>>
>>> 2. In file entitymodel.xml of party application, at PartyGroup entity
>>> definition, the groupNameLocal field is defined as:
>>> <field name="groupNameLocal" type="name"></field>
>>>
>>> 3. In table party_group of the postgres db, I find the field
>>> group_name_local has length 100. That's ok.
>>>
>>> 4. In the form create PartyGroup of party application, the groupNameLocal
>>> text box has size is 40. So I only type 40 characters. This opposite to all
>>> three above things.
>>>
>>> Could you give me suggestion?
>>> Thank you very much.
>>>
>>>
>>> 2008/10/25 BJ Freeman <bj...@free-man.net>
>>>
>>>> more detailed inline
>>>>
>>>> Vu Hong Thuan sent the following on 10/25/2008 3:16 AM:
>>>>> Hi,
>>>>> I'm a newbie in ofbiz. I have a question.
>>>>> The length of the entity field whose type is "name" is 100. By when is
>>>>> rendered as a textbox in form, the size of text box is 40.
>>>> Then the DB file that define that field type says it is 40.
>>>>
>>>>> I really don't know about the mismatch in size of file type and of
>>>> text-box
>>>>> form input.
>>>> you need to become familiar with how ofbiz works. you don't define max
>>>> field lengths in the UI, it is done at the entity level, and the DB file
>>>> for the DB you are using.
>>>>
>>>>
>>>>
>>>>> Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But
>>>> in
>>>>> the entity.config, type of GroupName field is "name" type. And length of
>>>>> "name" type is 100.
>>>>> How can I change the size of text-box of "name"-type entity field to 100?
>>>> This is defined in the file for the DB you are using.
>>>> since it will effect all fields in every entity with that type, it is
>>>> better to use extend-entity and create a new field that uses one of the
>>>> fieldtypes that uses a blob or text db type.
>>>>
>>>>> Thank for any suggestion.
>>>>>
>>>
>>
> 
> 

Re: Why length field "name" of entity is not match to textbox size?

Posted by BJ Freeman <bj...@free-man.net>.
put in a jira
https://issues.apache.org/jira/browse/OFBIZ-2021

BJ Freeman sent the following on 10/25/2008 11:22 AM:
> Ok yes you can define max less than the DB fieldtype.
> looks like some reformating is done in
> ModelFormField.java
> about like 548.
>            } else if ("name".equals(modelField.getType()) ||
> "short-varchar".equals(modelField.getType())) {
>                 ModelFormField.TextField textField = new
> ModelFormField.TextField(ModelFormField.FieldInfo.SOURCE_AUTO_ENTITY, this);
>                 textField.setSize(40);
>                 textField.setMaxlength(Integer.valueOf(60));
>                 this.setFieldInfo(textField);
> 
> 
> Vu Hong Thuan sent the following on 10/25/2008 10:18 AM:
>> Hi BJ,
>> Thank for suggestion. But I find some interesting:
>>
>> 1. I'm using PostgreSQL. And in the file
>> /framework/entity/fieldtype/fieldtypepostgres.xml, I find the following
>> line:
>> <field-type-def type="name" sql-type="VARCHAR(100)"
>> java-type="String"></field-type-def>
>> That means length of "type=name" field is equal to varchar(100) in postgres.
>>
>> 2. In file entitymodel.xml of party application, at PartyGroup entity
>> definition, the groupNameLocal field is defined as:
>> <field name="groupNameLocal" type="name"></field>
>>
>> 3. In table party_group of the postgres db, I find the field
>> group_name_local has length 100. That's ok.
>>
>> 4. In the form create PartyGroup of party application, the groupNameLocal
>> text box has size is 40. So I only type 40 characters. This opposite to all
>> three above things.
>>
>> Could you give me suggestion?
>> Thank you very much.
>>
>>
>> 2008/10/25 BJ Freeman <bj...@free-man.net>
>>
>>> more detailed inline
>>>
>>> Vu Hong Thuan sent the following on 10/25/2008 3:16 AM:
>>>> Hi,
>>>> I'm a newbie in ofbiz. I have a question.
>>>> The length of the entity field whose type is "name" is 100. By when is
>>>> rendered as a textbox in form, the size of text box is 40.
>>> Then the DB file that define that field type says it is 40.
>>>
>>>> I really don't know about the mismatch in size of file type and of
>>> text-box
>>>> form input.
>>> you need to become familiar with how ofbiz works. you don't define max
>>> field lengths in the UI, it is done at the entity level, and the DB file
>>> for the DB you are using.
>>>
>>>
>>>
>>>> Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But
>>> in
>>>> the entity.config, type of GroupName field is "name" type. And length of
>>>> "name" type is 100.
>>>> How can I change the size of text-box of "name"-type entity field to 100?
>>> This is defined in the file for the DB you are using.
>>> since it will effect all fields in every entity with that type, it is
>>> better to use extend-entity and create a new field that uses one of the
>>> fieldtypes that uses a blob or text db type.
>>>
>>>> Thank for any suggestion.
>>>>
>>
>>
> 
> 

Re: Why length field "name" of entity is not match to textbox size?

Posted by BJ Freeman <bj...@free-man.net>.
Ok yes you can define max less than the DB fieldtype.
looks like some reformating is done in
ModelFormField.java
about like 548.
           } else if ("name".equals(modelField.getType()) ||
"short-varchar".equals(modelField.getType())) {
                ModelFormField.TextField textField = new
ModelFormField.TextField(ModelFormField.FieldInfo.SOURCE_AUTO_ENTITY, this);
                textField.setSize(40);
                textField.setMaxlength(Integer.valueOf(60));
                this.setFieldInfo(textField);


Vu Hong Thuan sent the following on 10/25/2008 10:18 AM:
> Hi BJ,
> Thank for suggestion. But I find some interesting:
> 
> 1. I'm using PostgreSQL. And in the file
> /framework/entity/fieldtype/fieldtypepostgres.xml, I find the following
> line:
> <field-type-def type="name" sql-type="VARCHAR(100)"
> java-type="String"></field-type-def>
> That means length of "type=name" field is equal to varchar(100) in postgres.
> 
> 2. In file entitymodel.xml of party application, at PartyGroup entity
> definition, the groupNameLocal field is defined as:
> <field name="groupNameLocal" type="name"></field>
> 
> 3. In table party_group of the postgres db, I find the field
> group_name_local has length 100. That's ok.
> 
> 4. In the form create PartyGroup of party application, the groupNameLocal
> text box has size is 40. So I only type 40 characters. This opposite to all
> three above things.
> 
> Could you give me suggestion?
> Thank you very much.
> 
> 
> 2008/10/25 BJ Freeman <bj...@free-man.net>
> 
>> more detailed inline
>>
>> Vu Hong Thuan sent the following on 10/25/2008 3:16 AM:
>>> Hi,
>>> I'm a newbie in ofbiz. I have a question.
>>> The length of the entity field whose type is "name" is 100. By when is
>>> rendered as a textbox in form, the size of text box is 40.
>> Then the DB file that define that field type says it is 40.
>>
>>> I really don't know about the mismatch in size of file type and of
>> text-box
>>> form input.
>> you need to become familiar with how ofbiz works. you don't define max
>> field lengths in the UI, it is done at the entity level, and the DB file
>> for the DB you are using.
>>
>>
>>
>>> Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But
>> in
>>> the entity.config, type of GroupName field is "name" type. And length of
>>> "name" type is 100.
>>> How can I change the size of text-box of "name"-type entity field to 100?
>> This is defined in the file for the DB you are using.
>> since it will effect all fields in every entity with that type, it is
>> better to use extend-entity and create a new field that uses one of the
>> fieldtypes that uses a blob or text db type.
>>
>>> Thank for any suggestion.
>>>
> 
> 
> 

Re: Why length field "name" of entity is not match to textbox size?

Posted by Vu Hong Thuan <th...@gmail.com>.
Hi BJ,
Thank for suggestion. But I find some interesting:

1. I'm using PostgreSQL. And in the file
/framework/entity/fieldtype/fieldtypepostgres.xml, I find the following
line:
<field-type-def type="name" sql-type="VARCHAR(100)"
java-type="String"></field-type-def>
That means length of "type=name" field is equal to varchar(100) in postgres.

2. In file entitymodel.xml of party application, at PartyGroup entity
definition, the groupNameLocal field is defined as:
<field name="groupNameLocal" type="name"></field>

3. In table party_group of the postgres db, I find the field
group_name_local has length 100. That's ok.

4. In the form create PartyGroup of party application, the groupNameLocal
text box has size is 40. So I only type 40 characters. This opposite to all
three above things.

Could you give me suggestion?
Thank you very much.


2008/10/25 BJ Freeman <bj...@free-man.net>

> more detailed inline
>
> Vu Hong Thuan sent the following on 10/25/2008 3:16 AM:
> > Hi,
> > I'm a newbie in ofbiz. I have a question.
> > The length of the entity field whose type is "name" is 100. By when is
> > rendered as a textbox in form, the size of text box is 40.
> Then the DB file that define that field type says it is 40.
>
> > I really don't know about the mismatch in size of file type and of
> text-box
> > form input.
> you need to become familiar with how ofbiz works. you don't define max
> field lengths in the UI, it is done at the entity level, and the DB file
> for the DB you are using.
>
>
>
> > Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But
> in
> > the entity.config, type of GroupName field is "name" type. And length of
> > "name" type is 100.
> > How can I change the size of text-box of "name"-type entity field to 100?
> This is defined in the file for the DB you are using.
> since it will effect all fields in every entity with that type, it is
> better to use extend-entity and create a new field that uses one of the
> fieldtypes that uses a blob or text db type.
>
> >
> > Thank for any suggestion.
> >
>



-- 
Vũ Hồng Thuận
Công ty Phần mềm và Truyền thông Việt Nam, NAMMEDIA, INC.
Email: thuanvh@nammedia.com
Web: http://www.nammedia.com
ĐT: (84)-04-5680964 - Fax: (84)-04-5681083
DĐ: 0984328513

Vu Hong Thuan
Vietnam Software and Communication Company. NAMMEDIA. INC
Email: thuanvh@nammedia.com
Web: http://www.nammedia.com
Phone: (84)-04-5680964 - Fax: (84)-04-5681083
Mobile: (84)-984328513

Re: Why length field "name" of entity is not match to textbox size?

Posted by BJ Freeman <bj...@free-man.net>.
one more thought, if you want to define a field in the widget to be used
for process, not storage, then you can have it any length you want.
just be aware that any data in that field will be lost, once the session
is over.

BJ Freeman sent the following on 10/25/2008 8:20 AM:
> more detailed inline
> 
> Vu Hong Thuan sent the following on 10/25/2008 3:16 AM:
>> Hi,
>> I'm a newbie in ofbiz. I have a question.
>> The length of the entity field whose type is "name" is 100. By when is
>> rendered as a textbox in form, the size of text box is 40.
> Then the DB file that define that field type says it is 40.
> 
>> I really don't know about the mismatch in size of file type and of text-box
>> form input.
> you need to become familiar with how ofbiz works. you don't define max
> field lengths in the UI, it is done at the entity level, and the DB file
> for the DB you are using.
> 
> 
> 
>> Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But in
>> the entity.config, type of GroupName field is "name" type. And length of
>> "name" type is 100.
>> How can I change the size of text-box of "name"-type entity field to 100?
> This is defined in the file for the DB you are using.
> since it will effect all fields in every entity with that type, it is
> better to use extend-entity and create a new field that uses one of the
> fieldtypes that uses a blob or text db type.
> 
>> Thank for any suggestion.
>>
> 
> 

Re: Why length field "name" of entity is not match to textbox size?

Posted by BJ Freeman <bj...@free-man.net>.
more detailed inline

Vu Hong Thuan sent the following on 10/25/2008 3:16 AM:
> Hi,
> I'm a newbie in ofbiz. I have a question.
> The length of the entity field whose type is "name" is 100. By when is
> rendered as a textbox in form, the size of text box is 40.
Then the DB file that define that field type says it is 40.

> I really don't know about the mismatch in size of file type and of text-box
> form input.
you need to become familiar with how ofbiz works. you don't define max
field lengths in the UI, it is done at the entity level, and the DB file
for the DB you are using.



> Eg. In the form "createPartyGroup" size of GroupName text-box is 40. But in
> the entity.config, type of GroupName field is "name" type. And length of
> "name" type is 100.
> How can I change the size of text-box of "name"-type entity field to 100?
This is defined in the file for the DB you are using.
since it will effect all fields in every entity with that type, it is
better to use extend-entity and create a new field that uses one of the
fieldtypes that uses a blob or text db type.

> 
> Thank for any suggestion.
>