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
Piotr R SobczakPiotr R Sobczak 

Update custom object from site with input field

Hi,
I'm trying to update a field on a custom object on site.

 

I have sth like this

<apex:page standardController="Some_custom_object__c">
    <apex:form>
        <apex:inputField value="{!Some_custom_object__c.status__c}"/>
        <apex:commandButton action="{!save}" value="save"/>
    </apex:form>
</apex:page>

After clicking save button page is refreshed without any error but field is not updated.

It is simplified example I was trying to do similar update from within an extension controller action without success...

Any idea ?

Thanks
Best Answer chosen by Piotr R Sobczak
William TranWilliam Tran
Piotr,  

did you give an object context before updating and saving the field?

Like ....../apex/savetest?id=a081a0000016wbp

The other thing to check the valid values for status__c.

You don't have <apex:pageMessages/> so validation errors may not show up.

Thx
 
<apex:page standardController="Some_custom_object__c">
    <apex:form>
<apex:pageblock>
<apex:pageMessages/>
        <apex:inputField value="{!Some_custom_object__c.status__c}"/>
        <apex:commandButton action="{!save}" value="save"/>
</apex:pageblock>
    </apex:form>
</apex:page>

 

All Answers

Derek M HughesDerek M Hughes
Hi,

Have you checked the permission for the custom object in the site's Public Access Setting?

Regards
Derek
Piotr R SobczakPiotr R Sobczak
Yes, I added permission to edit this object. I even checked all persmissions for this object. Unfortunately, it didn't help. It is wierd , it was working yesterday and stopped today...
William TranWilliam Tran
Piotr,  

did you give an object context before updating and saving the field?

Like ....../apex/savetest?id=a081a0000016wbp

The other thing to check the valid values for status__c.

You don't have <apex:pageMessages/> so validation errors may not show up.

Thx
 
<apex:page standardController="Some_custom_object__c">
    <apex:form>
<apex:pageblock>
<apex:pageMessages/>
        <apex:inputField value="{!Some_custom_object__c.status__c}"/>
        <apex:commandButton action="{!save}" value="save"/>
</apex:pageblock>
    </apex:form>
</apex:page>

 
This was selected as the best answer
Piotr R SobczakPiotr R Sobczak
@William, Your clue with messages was very helpful, it appears that I was displaying id of an account and it was post back inside form that causes exception that i cannot update account....