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
Amanda Byrne- Carolina Tiger RescueAmanda Byrne- Carolina Tiger Rescue 

Can I prevent the display of an existing field value for an apex input field on a form?

We are launching a Tour Check-In app so guests may check in at a kiosk when they arrive.

The form makes use of the Attendee object that is part of our ticketing app. We do not collect attendee information in advance- the ticketing app creates Attendee records for each attendee with the ticket-purchaser's name at the time of ticket purchase.

Our custom app has a form to collect the attendee's information (they are agreeing to a legal release- so we need their mailing address). The form fields are blank when the guest goes to check in, except for the First Name and Last Name, which are populated with the purchaser's name

We'd prefer the fields were blank- I'm concerned that it would be too tempting not to bother modifying the name fields. Is there a way I can modify the code so that these fields are not prepopulated on the form?

Page Code
<detail>First Name<font class='detailError'>*</font></detail>

<apex:inputField value="{!CnP_PaaS_EVT__Event_attendee_session__c.CnP_PaaS_EVT__First_name__c}" required="true" styleClass="detail" id="firstNameField" >
                
     <apex:param name="attendeeFirstNameParam" value="{!CnP_PaaS_EVT__Event_attendee_session__c.CnP_PaaS_EVT__First_name__c}" assignTo="{!attendeeFirstName}"/>            
 </apex:inputField>

Constructor Code:
//Constructor
    public DTCI_Attendee_AB_Ctrl(ApexPages.StandardController controller) {         
        attendee = (CnP_PaaS_EVT__Event_attendee_session__c) controller.getRecord();         
        eventId = ApexPages.currentPage().getParameters().get('eventPageId');
        registrantId = ApexPages.currentPage().getParameters().get('registrantPageId');        
    }

Thanks in advance! Amanda
Andy BoettcherAndy Boettcher
You could have two String variables in your controller and bind them to your inputFields instead of the actual record values - then you can control them as you want but still retain the real values.
 
Public String strFirstName {
    get {
        if(strFirstName == null) { strFirstName = ''; }
        return strFirstName;
    }
   set { strFirstName = value; }
}
        
Public String strLastName {
    get {
        if(strLastName == null) { strLastName = ''; }
        return strLastName ;
    }
   set { strLastName  = value; }
}