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
dai developerdai developer 

fieldsets

Hello,

I have:

opportunity page, with standard and custom controller,

<apex:repeat value="{!$ObjectType.Opportunity.FieldSets.someOppField}" var="f">

<apex:outputLabel value="{!f.Label}" for="account__name2"/>
<apex:inputField value="{!Opportunity[f]}"  id="account__name2" />

</apex:repeat>

Everything is ok at this moment but then i try a second repeat with product fields,

<apex:repeat value="{!fields}" var="f">
                  <apex:inputfield value="{!merch[f.fieldPath]}"/>  
</apex:repeat>

and the code at the controller

public Product2 merch { get; set; }

public List<Schema.FieldSetMember> getFields() {
        return SObjectType.Product2.FieldSets.some_fieldset_at_producrt.getFields();
    }

It doesn´t work, it throws a javascript error, i´ve made some google on this error, it seems to be something with field type

More,

the three fields of the 'some_fieldset_at_product' are picklist

The javascript error:

Error: j_id0:j_id3:j_id29:j_id54:j_id55:0:j_id57: An error occurred when processing your submitted information.

Thanks
dai developerdai developer
It was my fault,

I had the product2 variable only declared as property, the solution was just to declare it again at the constructor

public  c_saveProject(ApexPages.StandardController controller){
     
     
      merch = new Product2();

Other way, propertys get initiated and thats why i lost data