You need to sign in to do that
Don't have an account?
sunny.kapoor1306
Save button not working
I have created a 'save' button in vf page but it just refreshes the page without saving
In the apex class page refrence is created automatically
do i have to do something else too?
here is apex class code:
public class clsdisplayleads
{
public PageReference Save() {
return null;
}
public list<Lead> getdetail()
{
list<Lead> led=[select name,Company,Salutation from lead where Status='Open - Not Contacted' or status='Working - Contacted'];
return led;
}
}
Is this a controler or an extension?
Either way I think you Save function needs to return a PageReference.
I dont knw much abt coding
so can you explain it further?
Did you write the VF page. Can you show me the first line.
You didnt wrore any logic in your save method, since there is no code it simply refreshing the page.
if you are using standard controller and extension u dont need to write a save method, you can just call save in your page.
Please post your code so its easy to debug.
apex code i have already shown above
this is vf code
<apex:page controller="clsdisplayleads" showHeader="false">
<apex:form >
<apex:pageBlock title="Leads">
<apex:pageBlockSection title="Leads" columns="3" >
<apex:repeat value="{!detail}" var="val">
<apex:outputfield value="{!val.salutation}"/>
<apex:outputfield value="{!val.name}" />
<apex:outputfield value="{!val.company}"/>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:inlineEditSupport event="ondblclick"/>
<apex:commandButton action="{!Save}" value="Save"/>
</apex:form>
</apex:page>
ok so this is a custom controller.
You need to do something in your save method and then return a pagereference. Like this:
public PageReference save() {
upsert YOURRECORD;
pg = new PageReference('/' + YOURRECORD.Id);
pg.setRedirect(true);
return pg;
}
actually i have applied inlineedit on double click in vf page so i want when i edit that and click save button,it saves that
ok
When I use inline edit I do not include a save method in my controller. I always use the standard controller and anything funky I use an extension. You could try removing the Save method from your controller. and then use this code snippet from my inline edit to modify your VF page. I'm not sure how this would work with a custom controller.
<apex:form >
<apex:pageBlock title="Enterprise Detail" mode="mainDetail" >
<apex:pageBlockButtons>
<apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
<apex:commandButton action="{!save}" id="saveButton" value="Save" style="display: none"/>
<apex:commandButton onclick="resetInlineEdit();return false;" id="cancelButton" value="Cancel" style="display: none"/>
<apex:commandButton action="{!delete}" id="deleteButton" value="Delete"/>
</apex:pageBlockButtons>
<apex:pageBlockSection showHeader="false" columns="1">
<apex:outputField value="{!Enterprise__c.Name}">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton, deleteButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!Enterprise__c.Changes_Lots__c}">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton, deleteButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!Enterprise__c.Description__c}">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton, deleteButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
will try this 2morrow
thanks for the help
@carlo
thanks sir,code was of gr8 help