• SDev5
  • NEWBIE
  • 85 Points
  • Member since 2010

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies

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

Folk,

 

I am having one dropdown on Visual Force page. Onchange event i am creating new options for this select using java script. And for this select option one String varible on controller.

 

VF tag:

  <apex:selectList onchange="javascript:change()" id="myselect" size="1" value="{!testSelect}">

<apex:selectOptions value="{!picklist}"></apex:selectOptions> </apex:selectList>

 JS Funtion:

 

<script language='JavaScript'>function change(){alert('{!$Component.form.block.myselect}'); tbox = document.getElementById('{!$Component.form.block.myselect}'); clearlistbox(tbox); for(i=0; i < 5 ; i++) { var no = new Option(); no.value = 'karthi' + i; no.text = 'karthi' + i; tbox[i] = no; } } function clearlistbox(lb){ for (var i=lb.options.length-1; i>=0; i--){ lb.options[i] = null; } lb.selectedIndex = -1; }</script>

 

 

 

Controller:

 

public List<SelectOption> getPicklist(){ List<SelectOption> options = new List<SelectOption>{new SelectOption('Silambarasan','Silambarasan'),new SelectOption('Velu','Velu'),new SelectOption('Banu','Banu')}; return options; } public String testSelect {set;get;}

 

On clicking the save button i am getting the following error:

 

j_id0:form:block:myselect: Validation Error: Value is not valid

 

 Full code for VF PAge:

 

<apex:page standardController="VbApp__c" extensions="VBAPPController" ><script language='JavaScript'>function change(){alert('{!$Component.form.block.myselect}'); tbox = document.getElementById('{!$Component.form.block.myselect}'); clearlistbox(tbox); for(i=0; i < 5 ; i++) { var no = new Option(); no.value = 'karthi' + i; no.text = 'karthi' + i; tbox[i] = no; } } function clearlistbox(lb){ for (var i=lb.options.length-1; i>=0; i--){ lb.options[i] = null; } lb.selectedIndex = -1; }</script> <apex:form ID="form"> <apex:sectionHeader title="Welcom to VB Application"/> <apex:pageBlock id="block"> <apex:pageBlockButtons location="both"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> Name:<apex:inputText value="{!vbname}"/><br/> PickList: <apex:selectList size="1" multiselect="false"> <apex:selectOptions value="{!picklist}"></apex:selectOptions> </apex:selectList> <br/> Myselect: <apex:selectList onchange="javascript:change()" id="myselect" size="1" value="{!testSelect}"> <apex:selectOptions value="{!picklist}"></apex:selectOptions> </apex:selectList> </apex:pageBlock> </apex:form></apex:page>

 and 

 

Example for page shows

 

After changed the dromdown. I am trying to save on this time I am gettingerror "j_id0:form:block:myselect: Validation Error: Value is not valid"

Hello. I have a custom VF component which contains an <apex:selectList> component, as follows:

 

<apex:component controller="picklistController" id="compPickList">
<apex:attribute name="SystemEntity" description="" type="String" required="true" default="Account" assignTo="{!systemObject}"></apex:attribute>
<apex:attribute name="picklistField" description="" type="String" required="true" default="Type" assignTo="{!picklist_Field}"></apex:attribute>
<apex:attribute name="value" description="" type="String[]" required="true"></apex:attribute>
<apex:selectList id="ddlPickList" value="{!value}" multiselect="true" size="4">
<apex:selectOptions value="{!pickListOptions}"></apex:selectOptions>
</apex:selectList>
</apex:component>

 

The component's controller is obvious, so am skipping it for now.

 

The component acceps two attributes which it uses to populate the selectList options. I am using this component in a page and it works fine, i.e. am able to retrieve the selected values from the component into the page as long as am working with the pre-populated options, the code is as follows:

 

 

<apex:page controller="sampleCon" id="myPage"> <apex:form id="myForm"> <c:sObjectFieldPicklistComponent id="accountPicklist" value="{!accountIndustry}" picklistField="Ownership" systemEntity="Account" /> <apex:commandButton value="Test" action="{!SaveValues}" /> </apex:form> </apex:page>

 

I am again skipping the page controller code as it's obvious, but do let me know if you want to see it.

 

Now, the problem starts when I add dynamic <option> to this multi-select picklist through JavaScript, am able to add them in the browser on the client side, but when I click on the command button to submit the user selected values, the previously working code breaks, the values are not submitted, the execution never enters the action function (in this case - SaveValues()), and I get a message in the System Log window:

 

myPage:myForm:accountPicklist:compPickList:ddlPickList: Validation Error: Value is not valid

 

Any idea what's happening here? I am suspecting that the system (not me) is checking the submitted values against the viewstate and is throwing an error somewhere which I am unable to trap and trace.

 

Can someone please explain this behavior, and if possible, a solution to get this thing going?

 

Thanks in advance!

Ajay

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

Folk,

 

I am having one dropdown on Visual Force page. Onchange event i am creating new options for this select using java script. And for this select option one String varible on controller.

 

VF tag:

  <apex:selectList onchange="javascript:change()" id="myselect" size="1" value="{!testSelect}">

<apex:selectOptions value="{!picklist}"></apex:selectOptions> </apex:selectList>

 JS Funtion:

 

<script language='JavaScript'>function change(){alert('{!$Component.form.block.myselect}'); tbox = document.getElementById('{!$Component.form.block.myselect}'); clearlistbox(tbox); for(i=0; i < 5 ; i++) { var no = new Option(); no.value = 'karthi' + i; no.text = 'karthi' + i; tbox[i] = no; } } function clearlistbox(lb){ for (var i=lb.options.length-1; i>=0; i--){ lb.options[i] = null; } lb.selectedIndex = -1; }</script>

 

 

 

Controller:

 

public List<SelectOption> getPicklist(){ List<SelectOption> options = new List<SelectOption>{new SelectOption('Silambarasan','Silambarasan'),new SelectOption('Velu','Velu'),new SelectOption('Banu','Banu')}; return options; } public String testSelect {set;get;}

 

On clicking the save button i am getting the following error:

 

j_id0:form:block:myselect: Validation Error: Value is not valid

 

 Full code for VF PAge:

 

<apex:page standardController="VbApp__c" extensions="VBAPPController" ><script language='JavaScript'>function change(){alert('{!$Component.form.block.myselect}'); tbox = document.getElementById('{!$Component.form.block.myselect}'); clearlistbox(tbox); for(i=0; i < 5 ; i++) { var no = new Option(); no.value = 'karthi' + i; no.text = 'karthi' + i; tbox[i] = no; } } function clearlistbox(lb){ for (var i=lb.options.length-1; i>=0; i--){ lb.options[i] = null; } lb.selectedIndex = -1; }</script> <apex:form ID="form"> <apex:sectionHeader title="Welcom to VB Application"/> <apex:pageBlock id="block"> <apex:pageBlockButtons location="both"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> Name:<apex:inputText value="{!vbname}"/><br/> PickList: <apex:selectList size="1" multiselect="false"> <apex:selectOptions value="{!picklist}"></apex:selectOptions> </apex:selectList> <br/> Myselect: <apex:selectList onchange="javascript:change()" id="myselect" size="1" value="{!testSelect}"> <apex:selectOptions value="{!picklist}"></apex:selectOptions> </apex:selectList> </apex:pageBlock> </apex:form></apex:page>

 and 

 

Example for page shows

 

After changed the dromdown. I am trying to save on this time I am gettingerror "j_id0:form:block:myselect: Validation Error: Value is not valid"

Hello. I have a custom VF component which contains an <apex:selectList> component, as follows:

 

<apex:component controller="picklistController" id="compPickList">
<apex:attribute name="SystemEntity" description="" type="String" required="true" default="Account" assignTo="{!systemObject}"></apex:attribute>
<apex:attribute name="picklistField" description="" type="String" required="true" default="Type" assignTo="{!picklist_Field}"></apex:attribute>
<apex:attribute name="value" description="" type="String[]" required="true"></apex:attribute>
<apex:selectList id="ddlPickList" value="{!value}" multiselect="true" size="4">
<apex:selectOptions value="{!pickListOptions}"></apex:selectOptions>
</apex:selectList>
</apex:component>

 

The component's controller is obvious, so am skipping it for now.

 

The component acceps two attributes which it uses to populate the selectList options. I am using this component in a page and it works fine, i.e. am able to retrieve the selected values from the component into the page as long as am working with the pre-populated options, the code is as follows:

 

 

<apex:page controller="sampleCon" id="myPage"> <apex:form id="myForm"> <c:sObjectFieldPicklistComponent id="accountPicklist" value="{!accountIndustry}" picklistField="Ownership" systemEntity="Account" /> <apex:commandButton value="Test" action="{!SaveValues}" /> </apex:form> </apex:page>

 

I am again skipping the page controller code as it's obvious, but do let me know if you want to see it.

 

Now, the problem starts when I add dynamic <option> to this multi-select picklist through JavaScript, am able to add them in the browser on the client side, but when I click on the command button to submit the user selected values, the previously working code breaks, the values are not submitted, the execution never enters the action function (in this case - SaveValues()), and I get a message in the System Log window:

 

myPage:myForm:accountPicklist:compPickList:ddlPickList: Validation Error: Value is not valid

 

Any idea what's happening here? I am suspecting that the system (not me) is checking the submitted values against the viewstate and is throwing an error somewhere which I am unable to trap and trace.

 

Can someone please explain this behavior, and if possible, a solution to get this thing going?

 

Thanks in advance!

Ajay