This topic is locked

field value displays different between Add, Edit and other pages

3/1/2011 5:37:54 PM
PHPRunner General questions
L
laonian author

I have a field "email" for email address. For layout concern, I changed the display for list page as (View as, Custom at Editor page):
$value="<a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('".strtr(db_addslashes($data["email"]),array("<" => "< ", ">" => " >" ))."', this, event, '150px')\">email</a>";
This does make the display of the list page look better ("email" instead of "longnames@somewhere.com"). There is no problem either for editing.
My problems are for the View, Print, Export pages. I would like to see the real email addresses when viewing the records in View, Print or Export pages, but what what I saw was "email". Could somebody help on how to reverse the display on these pages? Thanks.

Sergey Kornilov admin 3/3/2011

The typical suggestion is to add a field alias in SQL Query. This way you can setup a different 'View as' type for different pages showing either the field itself or it's alias on any given page.

select fiedl1,

field1 as field_alias from ...