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
adamproadampro 

Keep Receiving "Error: Unable to complete the requested data change"

Do you know why this keeps happening? I'm trying to design this page and I keep running into this. I've changed my approach at least 3 times and yet I keep coming back to it. The basic idea is I'm creating a survey of T/F questions. I am setting up a method each box will call to ensure only 1 box for each question is checked. Here's my code:

 

<apex:page controller="surveyController">
<apex:form id="form">
    
    <apex:sectionHeader title="Assessment" subtitle="SCP Support Standard Self-Assessment Sampling">
    <description>
        This sampling of the self-assessment will help you determine how your organization measures up <br/>
        to the SCP standards and introduces you to a sampling of elements within the program.
        <ul>
            <li>Answer either "YES" or "NO" to each of the following questions. If you do not know or <br/>
            are unsure, you should answer "NO".
            </li>
            
        </ul>
    </description>
    </apex:sectionHeader>
    
    <br></br>
    
    <apex:pageBlock id="followObjectBlock" title="Part 1">
        <br/>
        Yes No
        <br/>
        <br/>
        
        <apex:outputPanel id="Question1">
        <apex:inputCheckbox id="Q1True" value="{!checkQ1True()}"/>
        <apex:inputCheckbox id="Q1False" value="{!checkQ1False()}"/>
        
        1. Question 1
        </apex:outputPanel>
        <br/>
        <br/>
        <apex:inputCheckbox id="Q2True"/>
        <apex:inputCheckbox id="Q2False"/>
        2. Question 2
        <br></br>
        <br></br>
        
        <apex:inputCheckbox id="Q3True"/>
        <apex:inputCheckbox id="Q3False"/>
        3. Question 3
        <br></br>
        <br></br>
        <apex:commandButton id="CreateButton" value="Save" action="{!submitResults}"/>
        
    </apex:pageBlock>
</apex:form>
</apex:page>

 

public with sharing class surveyController {

    public Boolean Q1True {get;set;}
    public Boolean Q1False {get;set;}
    public Boolean Q2True {get;set;}
    public Boolean Q2False {get;set;}
    public Boolean Q3True {get;set;}
    public Boolean Q3False {get;set;}
    

    public void checkQ1True() {
        Q1False = false;
    }
    
    public void checkQ1False() {
        Q1True = false;
    }
    
    
    public void submitResults() {
        
        Survey_Response__c newResult = new Survey_Response__c(Question_1__c = Q1True);
        insert newResult;
        
    }

}

 

Best Answer chosen by Admin (Salesforce Developers) 
adamproadampro

Thanks. I just created a new VFP and copied the exact same code and it seems to be working now. 

All Answers

colemabcolemab

Exactly where / when do you get your error?  Do you have a log that shows the exception?

adamproadampro

I seem to be getting the error any time I try changing the command button. I've tried both deleting the element and renaming the element but neither fix the error. When I try saving in the developer console it returns the error message "Response from server was 500".

colemabcolemab

One error at a time.  When do you receive the first error? Is it while saving your page? Or is it while taking some action (such as clicking a button or link on the page)?  If it is action based, a log showing the exception would be most helpful.

 

 

adamproadampro

Sorry, I didn't realize I didn't answer the first question. I receive the error anytime I try to save the page.

colemabcolemab

I would recommend that you try your editing in the eclipse IDE on the thought that you would get a better / more informative error message while trying to save.   I say this on the beleif that your save isn't being committed due to a syntax error in your changes and the hope that the IDE would provide enough details about that error to identify and resolve the problem.

adamproadampro

Thanks. I just created a new VFP and copied the exact same code and it seems to be working now. 

This was selected as the best answer