function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aurora Ganguly 10Aurora Ganguly 10 

vf page queries

Hi , I have created a vf page , am sharing the preview of my page . I want to reduce the width between all the fields so that many more fields can be added .how to reduce the space between two fields .To make it come close . 

please advice on the same .User-added image
<apex:page Controller="AddmultipleAccountsController">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!listAccount}" var="acc">

<apex:column headerValue="Account Name">
<apex:inputField value="{!acc.Name}"/>
</apex:column>

<apex:column headerValue="Account Number">
<apex:inputField value="{!acc.AccountNumber}"/>
</apex:column>

<apex:column headerValue="Account Type">
<apex:inputField value="{!acc.Type}"/>
</apex:column>

<apex:column headerValue="Industry">
<apex:inputField value="{!acc.Industry}"/>
</apex:column>

</apex:pageBlockTable>
<apex:pageBlockButtons >

<apex:commandButton value="Add Accounts Row" action="{!addAccount}"/>
<apex:commandButton value="Save Accounts" action="{!saveAccount}"/>
</apex:pageBlockButtons>

</apex:pageBlock>
</apex:form>
</apex:page>

 
Best Answer chosen by Aurora Ganguly 10
Suraj TripathiSuraj Tripathi

Hi,

Please add style="width: 20%;" in your PageBlockTable like: 

<apex:pageBlockTable style="width: 20%;" value="{!listAccount}" var="acc">


User-added image
Hope it will help you.

If it helps you mark as a best.

Regards,

Suraj

All Answers

Aman MalikAman Malik
Hi Aurora,

Try to add new column in a table. PageBlockTable will automatically adjust them within a same row.

Thanks,
Aman
Suraj TripathiSuraj Tripathi

Hi,

Please add style="width: 20%;" in your PageBlockTable like: 

<apex:pageBlockTable style="width: 20%;" value="{!listAccount}" var="acc">


User-added image
Hope it will help you.

If it helps you mark as a best.

Regards,

Suraj

This was selected as the best answer
Aurora Ganguly 10Aurora Ganguly 10
Hi suraj / Aman ,
Thanks alot  !  Its solved . 
Let me tell one issue . am not aware whether how its possible or not . 
Can we reduce the size of text field .I mean Account name , Account number field. those. since i have taken as input field but unable to reduce the size. 
Hope u got my point 
please suggest once more .

Regards,
Aurora
Aurora Ganguly 10Aurora Ganguly 10
Thanks alot ! Its solved . Let me tell one issue . am not aware whether how its possible or not . Can we reduce the size of text field .I mean Account name , Account number field. those. since i have taken as input field but unable to reduce the size. Hope u got my point please suggest once more Thanks and regards, Aurora Ganguly m:8050319438/8697406601 BANGALORE LinkedIn : https://www.linkedin.com/in/aurora-ganguly-5326626a
Aurora Ganguly 10Aurora Ganguly 10
Hi,
On the above same topic ,

I have a vf page . There I have multiple consecutive input text fields . I have add button . on click of add button a set of fields come in the next row .  Can u suggest  if i want to give cancel button so that once i click on that the set of new row will dissapear . . i need to write a method but what should be there in the method am not getting . so that it will be deleted.


plz suggest .
 Regards
Aurora
Suraj TripathiSuraj Tripathi

Hi Aurora,

For adding new row you need to write wrapper class then you can achive that.

Thanks