Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Field Alignment and formatting (How to align and format field text)
Field Alignment and formatting [message #2745] Tue, 19 July 2011 09:12 Go to next message
grim is currently offline  grim
Messages: 11
Registered: July 2011
Location: Surrey, UK
Junior Member
Hi, I am very new to Radicore. I was drawn to it because of its workflow capabilities. I have installed Radicore on one of my Linux servers and its working fine. I am investigating its features and trying to get my head round them!!

I have a question around formating. I am displaying some figures using pattern list 1. I would like to be able to display the date as dd/mm/yyyy and to right justify the content of some numeric fields.

I have made all of the list 1 fields right justify by adding text-align: right to tr.even td and tr.odd td in the stype_custom.css. I haven't managed to do it for a single column yet. Am I going about this the correct way or should I be doing the mod somewhere else?

With regards to the date format change, I am not at all sure where I should be making these changes.

Any help will be greatly appreciated.

Thanks and regards

Graham Jones
Re: Field Alignment and formatting [message #2747 is a reply to message #2745] Wed, 20 July 2011 05:54 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
For dealing with date formatting, both input and output, take a look at FAQ113.

For left/center/right aligning of text within a column you need to modify the screen structure file, as documented in Screen Structure File. You wil see here that the options currently supported are:

  • width
  • class
  • align
  • valign
  • char
  • style


Re: Field Alignment and formatting [message #2748 is a reply to message #2745] Wed, 20 July 2011 12:14 Go to previous messageGo to next message
grim is currently offline  grim
Messages: 11
Registered: July 2011
Location: Surrey, UK
Junior Member
Thanks for your swift response. Date format works like a dream. However, I had already tried editing the <screen>.list1.screen.inc and adding the align clause to the column without any effect. I have coded the following - am I correct?:

$structure['main']['columns'][] = array('width' => '10%', 'align' => 'right');

Thanks and regards

Graham Jones
Re: Field Alignment and formatting [message #2749 is a reply to message #2748] Wed, 20 July 2011 12:23 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
That is definitely the correct syntax. You can see a working example of this in 'mnu_role.list1.screen.inc' which is used in the 'List Role' task within the Menu System.

Re: Field Alignment and formatting [message #2750 is a reply to message #2745] Wed, 20 July 2011 12:39 Go to previous messageGo to next message
grim is currently offline  grim
Messages: 11
Registered: July 2011
Location: Surrey, UK
Junior Member
I took a look at the role list and that does not display as directed in the mnu_role.list1.screen.inc either! I have tried with IE9 and Chrome, both with the same result.

Do you have any other suggestions that I might look at?

I see that you are from Sutton, I am just down the road from you in Lingfield - small world.

Thanks and regards

Graham Jones
Re: Field Alignment and formatting [message #2751 is a reply to message #2750] Wed, 20 July 2011 14:21 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
That code causes <COL ALIGN="RIGHT" /> to be inserted into the HTML output, and this has always worked in IE (certainly up to version 7) and Opera. This is in accordance with the HTML specification in section 11.2.4 and 11.3.2.

This does not work in Firefox due to bug#915, and I have just noticed that it no longer works in Safari.

It does not work in Google Chrome due to bug#12094.

I *DO* wish these browser developers would learn to read the W3C specifications and implement them properly!!!


Re: Field Alignment and formatting [message #2752 is a reply to message #2751] Thu, 21 July 2011 11:25 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
If <COL ALIGN="RIGHT" /> does not work then <COL CLASS="right" /> should, as both are valid according to the HTML 4.01 specification. It would appear that <COL ALIGN="RIGHT" /> will not be supported in HTML 5, but <COL CLASS="right" /> is still there, so *should* be supported by *ALL* browsers.

Note that CLASS="right" indicates a CSS class with the following contents:
.right {
  text-align: right;
}

This works in IE7, but not in IE8 (I don't know about IE9). It also does *NOT* work in Safari 5.0.5, Opera 11.50 and Firefox 5.0. Does anybody know a method of achieving this which *IS* supported by all browsers? Or is that too much to hope for?


Re: Field Alignment and formatting [message #2753 is a reply to message #2752] Thu, 21 July 2011 13:41 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
After playing around the only solution I have found that works in all the browsers at my disposal (IE7, IE8, Firefox, Opera and Safari) is to move the attribute from the <COL> element and add it to every <TD> element in the relevant column.

I have changed my code so that the 'align' and 'valign' attributes will be changed to 'class' instead. This means that:
'align' => 'left|center|right|justify'
and
'valign' => 'top|middle|bottom'

will be inserted into the XML file as if it were
'class' => 'left|center|right|justify|top|middle|bottom'

This means that existing screen structure files will produce the desired results without having to be modified manually to change 'align/valign' to 'class'.

I will release these modifications at the end of the month, but in the meantime you can test them out in the online demo application.


Re: Field Alignment and formatting [message #2754 is a reply to message #2745] Thu, 21 July 2011 15:00 Go to previous messageGo to next message
grim is currently offline  grim
Messages: 11
Registered: July 2011
Location: Surrey, UK
Junior Member
Thats great thanks. I was going to report back about using classes. I set one up called .aright but it didnt work as you say!!

If you would like me to test your change, please feel free to email me a copy of your changed file and I will install it on my server.

Thanks and regards

Graham Jones
Re: Field Alignment and formatting [message #2755 is a reply to message #2754] Thu, 21 July 2011 15:34 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
I've uploaded all the changes onto the Radicore server, so you can test them in your browser by running either the 'List Role' or 'List Subsystem' tasks in te online demonstration application.

Re: Field Alignment and formatting [message #2758 is a reply to message #2745] Fri, 22 July 2011 09:49 Go to previous messageGo to next message
grim is currently offline  grim
Messages: 11
Registered: July 2011
Location: Surrey, UK
Junior Member
That works fine thanks.

How does one go about getting updates to Radicore? Do we just download the latest version and reinstall?

Cheers

Gj
Re: Field Alignment and formatting [message #2760 is a reply to message #2758] Fri, 22 July 2011 12:41 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
Each release contains a copy of all the files, not just the ones that have changed since the previous release. You may re-install the whole kit and caboodle, or you may sort the zip file by date and extract only those files which have a change date which is greater than that of the release which you have currently loaded.

There is a file in the root directory called 'radicore-CCYY-MM-DD.txt' which contains a complete history of all changes. This may contain instructions on running an SQL script to update one of the databases.


Re: Field Alignment and formatting [message #2897 is a reply to message #2760] Sat, 10 March 2012 01:58 Go to previous messageGo to next message
edortizq is currently offline  edortizq
Messages: 82
Registered: August 2008
Location: Ecuador
Member

I have a database field VARCHAR(10) wich I need to show on screen with the following format:
"XXX-XXX-NNNN"
What should I do? alter the screen structure file? how?
Please let me know if there is some way to do it.
Thanks for advance!
Re: Field Alignment and formatting [message #2898 is a reply to message #2897] Sat, 10 March 2012 03:06 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
Altering the screen structure file won't do what you want. That can only be used to specify where on the screen a field will be displayed.

If you want to change how a field is formatted before it is displayed then take a look at the _cm_formatData() method.


Re: Field Alignment and formatting [message #2899 is a reply to message #2898] Sun, 11 March 2012 00:57 Go to previous message
edortizq is currently offline  edortizq
Messages: 82
Registered: August 2008
Location: Ecuador
Member

Thanks!!!
Previous Topic: Printing Labels
Next Topic: Use SQL REPLACE function in UPDATE SET
Goto Forum:
  


Current Time: Mon Nov 18 05:32:17 EST 2024

Total time taken to generate the page: 0.02929 seconds