You need to sign in to do that
Don't have an account?
Basic (hopefully) Formatting Question
Hello. I have run into what I think is a pretty simple formatting question...but I have no idea how to accomplish what I want.
In short, I want to display four pieces of data within a PageBlock (an employee's name, age, birthday, birthplace). These are not inputFields...but instead the values of variables. My goal is to display this information on two lines...I would like for the name and age to display on the first line...and the birthday and birthplace to display on the second line.
Unfortunately, what I have below looks messy (the top right column does not always align with the bottom right column). I tried using the <apex:column> command...but this only works for data tables (and I am obviously not displaying a table of records here).
Any suggestios on how to get this information to line up would be much appreciated.
<apex:pageBlockSection title="Employee Details" columns="2"> <apex:pageBlockSectionItem > <b>Name: </b> {!EmpName} <b>Age:</b> {!EmpAge} <b>Birthdate: </b> {!EmpBDay} <b>Birthplace: </b> {!EmpBPlace} </apex:pageBlockSectionItem> </apex:pageBlockSection>
Try the following code:
You can style attribute in all the tags to make it look better
Hope this helps you
All Answers
What about using the apex:outputField tag?
If the fields are sObject fields then labels will be taken care of automatically, and you'll get two columns as you specified that in the pageBlockSection attribute.
Try the following code:
You can style attribute in all the tags to make it look better
Hope this helps you
Thanks for both responses. The OutputField idea would not work since I am not displaying SObject fields...but the <table> suggestion worked.
I appreciate the help.
In that case, you can use apex:outputText with apex:outputLabel to retain the salesforce formatting.
Thanks. That makes sense.
One question though. I am able to bold the value of the OutputText with the command style="font-weight:bold;" . However, there are no changes when I add this code to the OutputLabel command. Any thoughts?
Again, thanks for the help.
I believe the outputLabel is already bold due to inheriting the label style from salesforce, which scales lable font to be slightly smaller than outputText but bold. If you changed it to style="font-weight:normal;" you should see a difference.
Great point. I checked and you were right. Thanks again.