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
amrit bansalamrit bansal 

could not able to set field values of custom object type variable from visualforce page <inputfield>,my code is following


VF Page:
<apex:page controller="hb1" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!alsat.name}"/>
<apex:inputField value="{!alsat.Date_and_Time_of_allotment__c}"/>
<apex:inputField value="{!alsat.Hotels_Lodges__c}"/>
<apex:inputField value="{!alsat.Booking_Period__c}"/>
<apex:inputField value="{!alsat.Members__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

controller:
public class hb1 {
alloted_satsangi__C alsat;

public void setalsat(alloted_satsangi__C al){
alsat = new alloted_satsangi__C();
alsat.name = al.name;
alsat.Date_and_Time_of_allotment__c=al.Date_and_Time_of_allotment__c;
alsat.Hotels_Lodges__c=al.Hotels_Lodges__c;
alsat.Booking_Period__c=al.Booking_Period__c;
alsat.Members__c=al.Members__c;
}

public alloted_satsangi__C getalsat(){
return alsat;
}

public void save(){
insert alsat;}

}
VineetKumarVineetKumar
Try the below controller:
public class hb1 {
	public alloted_satsangi__C alsat {get; set;}

	public hb1(){
		alsat = new alloted_satsangi__C();
	}
	public void save(){
		insert alsat;
	}

}
amrit bansalamrit bansal
The kind of following error pops: Error: hb1 Compile Error: The method alloted_satsangi__c getalsat() is referenced by Visualforce Page (hotel_bookings) in salesforce.com. Remove the usage and try again. at line 13 column 16
VineetKumarVineetKumar
just remove the whole page code save it, then save the class.
Paste back the removed code of the page.