Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

How to display two ...
 
Notifications
Clear all

How to display two fields on same line ?

10 Posts
2 Users
0 Reactions
13.4 K Views
(@jean-luc)
Posts: 73
Active Member
Topic starter
 
[#1842]

I added for clients a Taxnum field as varchar(32), for VAT Nr.

How to do to display it near the field 'tax' on the same line ?


 
Posted : 13 Jun 2014 17H32
(@babynus)
Posts: 14952
Member Admin
 

add "nobr" attribute on previous field.


 
Posted : 13 Jun 2014 18H16
(@jean-luc)
Posts: 73
Active Member
Topic starter
 

Added

private static $_fieldsAttributes=array("tax"=>"nobr"
  );

and

protected function getStaticFieldsAttributes() {
    return self::$_fieldsAttributes;
  }

in model/Client.php (no $_fieldsAttributes was defined in this module, so I took example on model/Project.php)

… but don’t works !

I probably missed something, but what ?


 
Posted : 13 Jun 2014 18H31
(@babynus)
Posts: 14952
Member Admin
 

You did it right.
I don't know why it dow not work.

Possibly one of the two fields is too big.
You can try to add attribute "smallWidth" or "mediumWidth"


 
Posted : 13 Jun 2014 19H05
(@jean-luc)
Posts: 73
Active Member
Topic starter
 

Indeed, field size problem. Reduced "taxnum" from 32 to 24 bytes, and this field comes besides "tax". 🙂

… but without its label… :pinch:

Is another parameter requested ? 🙁

Note: only field size reduction works OK. "smallWidth" permits 32 bytes, but strongly reduces (too) the input/display field.

Edit : "mediumWidth" gives a better width.


 
Posted : 13 Jun 2014 19H24
(@babynus)
Posts: 14952
Member Admin
 

No.
nobr hides label of second field.
In common design, if fileds are on same line, then label if for both.


 
Posted : 13 Jun 2014 19H45
(@jean-luc)
Posts: 73
Active Member
Topic starter
 

Too bad. So I have to leave on separate lines…

Thanks.


 
Posted : 13 Jun 2014 19H52
(@jean-luc)
Posts: 73
Active Member
Topic starter
 

Banynus, you didn’t said everything… 😆

It is possible to have several fields on same line with their labels, by using arrays.

Seen p.e. on projectPlanningElement. I’ll will try in the future. 😉


 
Posted : 19 Jun 2014 14H54
(@babynus)
Posts: 14952
Member Admin
 

You can use array (see exemple in ActivityPlanningElement.php).

But then you'l have something like
"Label 1" "Label 2"
"main label" Fld 1 Fld2

I guess what you expect is :
"label 1" : fld1 "label 2" : fld2

But this is not possible.

All you can do is change label to get :
"label 1 / label 2" : Fld1 Fld2


 
Posted : 19 Jun 2014 15H52
(@jean-luc)
Posts: 73
Active Member
Topic starter
 

In projectPlanningElement, there is specifics labels for fields in the last column. 😉

No problem, I will try myself. 🙂


 
Posted : 19 Jun 2014 16H03
Share:

Scroll to Top