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
CloudConversionCloudConversion 

"Validation Error: Value is not valid" Error??? URGENT

I have a client who is experiencing the following error on a custom controller and we can't find any solutions. 

 

It's just a selectList with a value tied to a String.

 

"j_id0:theForm:j_id2:j_id13:j_id14:j_id16:mySolutionOption: Validation Error: Value is not valid"

 

Any ideas?

 

Thanks,

Jon

Best Answer chosen by Admin (Salesforce Developers) 
SDev5SDev5

I was able to find a workaround for this issue.

In my case I am using 3 tabs and 2 picklists are used for each tab. So for 3 tabs there are total of 6 picklists.

The issue was values for each pair of picklists were different for each tab. And due to values mismatch it was giving error on tab switch.

So the workaround that I found for this issue is :

I wrote small javascript code that is being called on tab change. Following is the javascript code I used. This refers the picklist and sets its value to  empty string :

document.getElementById ('page: myform1:block2:Info1: firstTable: 0:select1').value = '';

document.getElementById ('page: myform2:block2:Info2: secondTable: 1:select2').value = '';

 

This code just sets the value for each picklist to '  '(Empty String) temporarily. This is the default value for each picklist. So, when the page get loads completely original values overrides this default value and you get the value expected.

This way it does not give any validation error as default value is present in each picklist for each tab.   

All Answers

NikiVNikiV
Can you give a few more details:  Are you trying to save a record in the controller?  Could that object have a Validation rule on it that is triggered and showing in the UI?  Maybe a screen shot would help.
MukulMukul

Hi Jon,

 

Did you find a solution to it. I am facing a similar issue.

 

Regards

Mukul

SivarajanSivarajan
Hi .... Did u ppl find any solution for this ? I am facing the same issue...
CloudConversionCloudConversion

No, we never found the solution and the error seems to be sporadic.  I'm going to log a case now and see if they can track down the issue.

 

--Jon 

SivarajanSivarajan

Is this issue has any connection with the "switchType" attribute that we use ?? 

Currently I am using switchType= "client"

What if I use switchType = "ajax" ?? 

SDev5SDev5

I was able to find a workaround for this issue.

In my case I am using 3 tabs and 2 picklists are used for each tab. So for 3 tabs there are total of 6 picklists.

The issue was values for each pair of picklists were different for each tab. And due to values mismatch it was giving error on tab switch.

So the workaround that I found for this issue is :

I wrote small javascript code that is being called on tab change. Following is the javascript code I used. This refers the picklist and sets its value to  empty string :

document.getElementById ('page: myform1:block2:Info1: firstTable: 0:select1').value = '';

document.getElementById ('page: myform2:block2:Info2: secondTable: 1:select2').value = '';

 

This code just sets the value for each picklist to '  '(Empty String) temporarily. This is the default value for each picklist. So, when the page get loads completely original values overrides this default value and you get the value expected.

This way it does not give any validation error as default value is present in each picklist for each tab.   

This was selected as the best answer
srinivas b 32srinivas b 32
@SDev5 :
We tried the same by using inspect element and given the elementId. Still Im vacing the issue. Could you please guide us if there is any other solution.

Thanks
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student
Make sure you set the actual component to ''; in javascript rather than the created variable. I was stuck on this for ages and just solved it.
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student
On change:

 function MessageRender(Body) {
 var MessageBodyHidden2 = Body.options[Body.selectedIndex].value;
 var MessageBody = document.getElementById('j_id0:j_id79:j_id80:ComponentForm:j_id90:j_id91:myEmailModal:j_id97:myPanel1:j_id100:MessageBody');
 MessageBody.value = MessageBodyHidden2;
 Body.options[Body.selectedIndex].value = '';
    //updateState();
}

<apex:selectList multiselect="false" id="TemplateList" size="1" value="{!Template2}"  onchange="javascript:MessageRender(this)" title="Type"  styleClass="form-control">