You need to sign in to do that
Don't have an account?
Manjeet
Plz help on Reset Issues
<apex:pageblockSection columns="3" title="Search By" collapsible="false"> <apex:pageblockSectionItem id="prospectRefId"> Prospect Ref No <apex:inputText id="txt12345" value="{!prospectRefNo}" /> </apex:pageblockSectionItem> <apex:inputField value="{!Prospects.Customer_Name__c}" id="Custom123" /> <apex:inputField value="{!Prospects.Prospect_Source__c}" /> <apex:inputField value="{!Prospects.Type_Of_Relationship__c}" /> <apex:pageBlockSectionItem > <apex:commandButton reRender="thePanel123,myId,thePanel" action="{!search}" value="Search" /> <apex:commandButton reRender="Custom123,txt12345,thePanel" action="{!reset}" value="Reset" immediate="true" /> </apex:pageBlockSectionItem> </apex:pageblockSection>
I want to reset all fields . But only customer name is reset by my reset method .
reset method code : public PageReference reset(){ Prospects.customer_name__c = null; Prospects.Prospect_Source__c = ''; setProspectRefNo(null); return null; }
thanks in advance .......
Hi Manjeet,
Try and put id=" " for all the attributes you need to reset in the inputField.
And then mention those id's in the command Button reRender attribute.
Hope this works for you!!!
yah
Its working for inputField of type text but not for inputText and inputField having PickList dataType's list .
solutoin would be appreciated...
Hi Manjeet,
If you are encountering the problem in Resetting InputField of Picklist Type.
Try using custom picklists as shown below :
// Apex Code
public List<SelectOption> getCustomerProspect(){
Schema.DescribeFieldResult F = Sobjectname.FieldName.getDescribe();
List<Schema.PicklistEntry> P = F.getPicklistValues();
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('','--All--')); // if required
for(Integer i = 0; i < P.size(); i++){
options .add(new SelectOption(P[i].getValue(), P[i].getLabel()));
}
return options ;
}
and then in your Reset Function the property used in "SelectList" as null as shown in below code:
public PageReference reset()
{
strCustomerProspect = null;
}
This should work for you!!!
Hope this helps.