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
Matt Cooper 7Matt Cooper 7 

Can you hide field lines without getting rid of header style?

Hi,

I am trying to build out a new Visualforce page and I'm trying to mess with the styling.  I want to remove the field lines (currently using PageBlock mode="edit"), but I want to keep the tabstyle (colored pageblocksection headers).  Is there a way to accomplish this?

Thanks!

Mahesh DMahesh D
Hi Matt,

Please paste your existing code and it will be easy to troubleshoot and provide the solution.

Regards,
Mahesh
Matt Cooper 7Matt Cooper 7
Apex Class:
public class customerPortalCls {
 
       public Account a {get;set;}
 	   public Contact c {get;set;}
       public User u {get;set;}
       public User newUser {get;set;}
       public String selectedProfileId {get;set;}
       public String selectedUserLicenseId {get;set;}
       public Boolean isDisabled {get;set;}
       public Boolean isNewUserFound {get;set;}
       public Boolean clickedButton {get;set;}
       public Boolean contractLic {get;set;}
       public Boolean AppLic {get;set;}
       public static String exceptionText {get; set;}
       public ID userId2 {get; set;}

       
       //Constructor
       public customerPortalCls() {
            contractLic = true;
            
        	exceptionText = 'Initialized';
            u = new User();
            u.LocaleSidKey = 'en_US';
            u.LanguageLocaleKey = 'en_US';
            u.TimeZoneSidKey = 'America/Los_Angeles';
        	newUser= new User();
        	isDisabled=false;	
        	System.debug('inside constructor');
        	isNewUserFound=false;
        	clickedButton = false;
    	}
    	
    public void updateUsername(){
        if(u.email.contains('@nike.com')){
            u.username = u.email.replace('@nike.com', '@cranium.com');
        }
        else if(u.email.contains('@converse.com')){
               u.username = u.email.replace('@converse.com', '@cranium.com');
           }
        else if(u.email.contains('@hurley.com')){
               u.username = u.email.replace('@hurley.com', '@cranium.com');
           }
        else {
            u.username = u.email;
        }
    }
       public static void assignLicenseByProfile(ID userid, Boolean conLic, Boolean ApprLic) {
        //find the PackageLicense Id

           if(conLic = true){  
        PackageLicense Contractpl = [SELECT Id, NamespacePrefix, AllowedLicenses, UsedLicenses, 
        					 ExpirationDate,Status FROM PackageLicense WHERE 
        					 NamespacePrefix = 'Apttus'];
        System.assert(Contractpl != null, 'PackageLicense cannot be null.');

        //create a new UserPackageLicense record for each user with the specified profile
        
        UserPackageLicense Contractupl = new UserPackageLicense();
        Contractupl.PackageLicenseId = Contractpl.Id;
        Contractupl.UserId = userid;
 
        try {
          //bulk insert
          insert Contractupl;
          } catch(DmlException e) {
             for (Integer i = 0; i < e.getNumDml(); i++) {
             // process exception here 
               System.debug(e.getDmlMessage(i)); 
               String status = e.getDmlStatusCode(i);
               System.debug(status + ' ' + e.getDmlMessage(i));
               if(status.equals('LICENSE_LIMIT_EXCEEDED')){
                exceptionText = 'You tried to assign more licenses than available. ' 
                +' There are only '
                + (Contractpl.AllowedLicenses - Contractpl.UsedLicenses) + ' Apttus Contract Management licenses free.';
                System.debug(exceptionText);
               }
             }
         }
           }
           if(ApprLic = true){  
        PackageLicense APPpl = [SELECT Id, NamespacePrefix, AllowedLicenses, UsedLicenses, 
        					 ExpirationDate,Status FROM PackageLicense WHERE 
        					 NamespacePrefix = 'Apttus_Approval'];
        System.assert(APPpl != null, 'PackageLicense cannot be null.');

        //create a new UserPackageLicense record for each user with the specified profile
        
        UserPackageLicense APPupl = new UserPackageLicense();
        APPupl.PackageLicenseId = APPpl.Id;
        APPupl.UserId = userid;
 
        try {
          //bulk insert
          insert APPupl;
          } catch(DmlException e) {
             for (Integer i = 0; i < e.getNumDml(); i++) {
             // process exception here 
               System.debug(e.getDmlMessage(i)); 
               String status = e.getDmlStatusCode(i);
               System.debug(status + ' ' + e.getDmlMessage(i));
               if(status.equals('LICENSE_LIMIT_EXCEEDED')){
                exceptionText = 'You tried to assign more licenses than available. ' 
                +' There are only '
                + (APPpl.AllowedLicenses - APPpl.UsedLicenses) + ' Apttus Approvals Management licenses free.';
                System.debug(exceptionText);
               }
             }
         }
           }
       }
        
    
       public PageReference checkForNewUser(){
       	try{
       		System.debug('isNewUserFound: ' + isNewUserFound);
          if(isNewUserFound==true)
           	return null;
       	  
       	  System.debug('checking for new user with username:' + u.username);
       	  User usr = [select id, name, username from User where username= :u.username LIMIT 1];
       	  if(usr!=null && usr.username == u.username){
       	     newUser = usr;
       	     isNewUserFound = true;
       	     System.debug('great news - found user with userId: ' + newUser.id);
       	     System.debug('isNewUserFound: ' + isNewUserFound);
       	  }
       	  return null;
       	}catch(Exception ex){
       		System.debug('...didnt find user yet...');
       		return null;
       	}
       }	
       
       //Controller method invoked from the VF page button
       public PageReference createPortaluser(){
        try{
        	clickedButton = true;
			
	        //Since the user is created asynchronously, we want to do some data validation to ensure the proper fields are populated
	        if(selectedProfileId == null || u.username==null){
	        	if(selectedProfileId==null){
	        		ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Profile is required: Please select a profile to associate new user');
					ApexPages.addMessage(myMsg);
	        	}
	        	if(u.username==null){
	        	   ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Username is required: Please a username for the new user');
				   ApexPages.addMessage(myMsg);
	        	}
	        	return null;
	        }
        	
        	//Create the User
	        //NOTE - Must invoke a @future method to be able to create Account, Contacts, and Users in the same Apex Transaction
	        customerPortalCls.createUser(u.Email, u.FirstName, u.lastname,u.Username,selectedProfileId,u.LocaleSidKey,u.LanguageLocaleKey,u.TimeZoneSidKey,u.Public_Groups__c,u.X_Author__c,u.Able_to_Create_Agreements__c, u.View_Only__c, u.Approvals_License__c, u.echosign_dev1__EchoSign_Allow_Delegated_Sending__c, contractLic, AppLic);
	        
	        //Display success message to VF page
	        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO, 'Successfully created User.');
			ApexPages.addMessage(myMsg);
			 isDisabled=true;
            checkForNewUser();
	        return null;
        }catch(Exception ex){
        	//Display error message to VF page
        	ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
			ApexPages.addMessage(myMsg);
   	  	    return null;
        }
       }
       

    //Async method, using @future, to create the User record and associate it to the previously created Contact
    //This uses @future because you can not have mixed DML operations for standard objects (Account, Contact) and Setup objects(User)
    static void createUser(String email, String firstName, String lastName, String userName, String profileId, String locale, String language, String timezone, String PGs, Boolean XAuth, Boolean abCreate, Boolean VOnly, Boolean AppLic, Boolean EchoS, Boolean conLice, Boolean AppLice) {
        Database.DMLOptions dmo = new Database.DMLOptions();
		dmo.EmailHeader.triggerUserEmail = false;
        String alia = firstname.left(1) + lastName.left(4);
    	User u = new User(email=email, 
            alias = alia, emailencodingkey='UTF-8', firstname = firstname, lastname=lastname, languagelocalekey=language, 
            localesidkey=locale, profileid = profileId, Public_Groups__c = PGs, X_Author__c = XAuth, Able_to_Create_Agreements__c = abCreate, View_Only__c = VOnly, Approvals_License__c = AppLic,echosign_dev1__EchoSign_Allow_Delegated_Sending__c = EchoS,
            timezonesidkey=timezone, username=username, UserPreferencesContentNoEmail=true, UserPreferencesContentEmailAsAndWhen=true, ReceivesInfoEmails=false, ReceivesAdminInfoEmails=false);

        u.setOptions(dmo);
        system.debug('Email: ' + email + '   firstname: ' + firstname + '  Lastname: ' + lastname + 'language: ' + language + ' Username: ' + username + ' ProfileId: ' + profileId + ' Locale: ' + locale + ' Language: ' + language + ' Timezone: ' + timezone + ' Public Groups: ' + PGs);
        insert u;
        assignLicenseByProfile(u.id, conLice, AppLice);
    }

    public List<SelectOption> getCustomerPortalProfiles() {
    	//Execute query to get all profiles associated to Customer Portal
        //Profile[] profiles = [Select Id,Name From Profile where UserLicenseId=:u.UserType];
   	 	List<SelectOption> options2 = new List<SelectOption>();
        for(Profile p:[SELECT Id,Name FROM Profile where UserLicense.Id=:u.UserType ORDER BY Name ASC]){
   	 		  options2.add(new SelectOption(p.Id,p.Name));
    		}
        //options2.sort();
   	 	return options2;
    }
    
    public List<selectOption> getLicense()
    {
        List<selectOption> options = new List<selectOption>(); //new list for holding all of the picklist options
        options.add(new selectOption('', '- None -')); //add the first option of '- None -' in case the user doesn't want to select a value or in case no values are returned from query below
          for (UserLicense users :[SELECT Id,Name FROM UserLicense])  
          {    
                options.add(new selectOption(users.Id, users.Name)); //for all records found - add them to the picklist options
          }
        return options; //return the picklist options
    }
    
    public PageReference reset(){
        PageReference newpage = new PageReference('/apex/customerPortalClsPage');
        newpage.getParameters().clear();
        newpage.setRedirect(true);
        return newpage;
    }
    
}

Visualforce Page:
<apex:page controller="customerPortalCls" tabStyle="User">

<apex:pageMessages />

<apex:form >
 
<!-- <apex:actionStatus startText="Searching for new user...." id="statusId"/>  -->
<apex:actionPoller interval="5" action="{!checkForNewUser}" rerender="userOutput" status="statusId"/>
<apex:outputPanel id="userOutput" rendered="{!IF(clickedButton=true,true,false)}">
<br/>
<b>This section will populate with the newly created User information. </b>
<br/>
Please <a href='/{!newUser.id}'>click here</a> to see the new User record 
<br/>
User Id: {!newUser.id}<br/>
</apex:outputPanel>  
</apex:form>

<apex:form >
<apex:pageBlock id="pageBlockId" title="Create a New User" mode="edit" tabStyle="User">

<apex:pageBlockButtons location="bottom">
<apex:commandButton disabled="{!(!IF(isDisabled=true,false,true))}" onclick="return confirm('Are you sure you want to create this portal user in your org?')" action="{!createPortaluser}" value="Create Account, Contact, and User"/>
<apex:commandButton disabled="{!(!IF(isDisabled=true,true,false))}" rerender="pageBlockId" action="{!reset}" value="Reset" />
</apex:pageBlockButtons>

<apex:pageBlockSection title="Enter in User Details" columns="2" >
    
    <apex:pageBlockSectionItem >
        <apex:outputLabel value="First Name" for="uFirstname" />
        <apex:inputField taborderhint="1" value="{!u.firstname}" id="uFirstname">
        </apex:inputField>
    </apex:pageBlockSectionItem>
    
    <apex:pageBlockSectionItem >
          <apex:outputLabel value="User License" for="lic"></apex:outputLabel>
         <apex:actionRegion >
          <apex:selectList id="ut" value="{!u.UserType}" size="1" tabindex="50" >
             <apex:selectOptions value="{!license}" ></apex:selectOptions>
             <apex:actionSupport event="onchange" rerender="profileList,test"/>
       </apex:selectList>
             </apex:actionRegion>
    </apex:pageBlockSectionItem>
    
    <apex:pageBlockSectionItem >
        <apex:outputLabel value="Last Name" for="uLastname" />
        <apex:inputField value="{!u.lastname}" id="uLastname" taborderhint="2"/>  
    </apex:pageBlockSectionItem>
    
    <apex:pageBlockSectionItem >
        <apex:outputLabel for="profileList" value="Profile" id="text"/>
        <apex:selectList value="{!selectedProfileId}" multiselect="false" id="profileList" size="1" tabIndex="70">
             <apex:selectOptions value="{!customerPortalProfiles}"/>
        </apex:selectList>
	</apex:pageBlockSectionItem>
    
    <apex:pageBlockSectionItem >
        <apex:outputLabel value="Email Address" for="uEmail" />
        <apex:actionRegion >
        <apex:inputField value="{!u.email}" id="uEmail" taborderhint="3"  >   
			<apex:actionSupport event="onchange" action="{!updateUsername}" rerender="uUsername"></apex:actionSupport>        
        </apex:inputField>
        </apex:actionRegion>
    </apex:pageBlockSectionItem>
    
    <apex:pageBlockSectionItem />
    
    <apex:pageBlockSectionItem >
        <apex:outputLabel value="Username" for="uUsername" />
        <apex:inputField value="{!u.username}" id="uUsername" taborderhint="4"/>
        </apex:pageBlockSectionItem>

	</apex:pageBlockSection>

    <apex:pageblocksection title="Additional Information" columns="1">
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="X-Author" for="uXAuth" /> 
            <apex:inputCheckBox value="{!u.X_Author__c}" id="uXAuth" tabIndex="80"/>
        </apex:pageBlockSectionItem>
        
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Able to Create Agreements" for="uCreatAgmt" /> 
            <apex:inputCheckBox value="{!u.Able_to_Create_Agreements__c}" id="uCreatAgmt" tabIndex="90"/>
        </apex:pageBlockSectionItem>
                
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="View Only" for="uView" /> 
            <apex:inputCheckBox value="{!u.View_Only__c}" id="uView" tabIndex="100"/>
        </apex:pageBlockSectionItem>
                
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Approval License" for="uAppLic" /> 
            <apex:inputCheckBox value="{!u.Approvals_License__c}" id="uAppLic" tabIndex="110"/>
        </apex:pageBlockSectionItem>
        
        
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="EchoSign - Allow Sending As Other Users" for="uEchosign" /> 
            <apex:inputCheckBox value="{!u.echosign_dev1__EchoSign_Allow_Delegated_Sending__c}" id="uEchosign" tabIndex="120"/>
        </apex:pageBlockSectionItem>
        
		<apex:pageBlockSectionItem >
            <apex:outputLabel value="Public Groups" for="uPGs" /> 
            <apex:inputField value="{!u.Public_Groups__c}" id="uPGs" taborderhint="13"/>
        </apex:pageBlockSectionItem>
        
    </apex:pageblocksection>
	<apex:pageblocksection title="Locale Settings" columns="1">
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Time Zone" for="uTimeZone" /> 
            <apex:inputField value="{!u.TimeZoneSidKey}" id="uTimeZone" taborderhint="14"/>
        </apex:pageBlockSectionItem>
        
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Locale" for="uLocale" /> 
            <apex:inputField value="{!u.LocaleSidKey}" id="uLocale" taborderhint="15"/>
        </apex:pageBlockSectionItem>
                
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Language" for="uLanguage" /> 
            <apex:inputField value="{!u.LanguageLocaleKey}" id="uLanguage" taborderhint="16"/>
        </apex:pageBlockSectionItem>
    </apex:pageblocksection>
    
    <apex:pageblocksection title="Managed Package Licenses">
		<apex:pageBlockSectionItem >
            <apex:outputLabel value="Apttus Contract Management" for="uContractLic" /> 
            <apex:inputCheckBox value="{!contractLic}" id="uContractLic" tabIndex="90"/>
        </apex:pageBlockSectionItem>
                
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Apttus Approvals Management" for="uAppLic" /> 
            <apex:inputCheckBox value="{!AppLic}" id="uAppLic" tabIndex="100"/>
        </apex:pageBlockSectionItem>
    </apex:pageblocksection>
    
</apex:pageBlock>

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