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
emuelasemuelas 

Visualforce Error:value for inputField is not a dynamic binding!

I have the following visualforce code and controller:
The error seems to be in the "<apex:inputField>" tag,
If i change this to <apex:inputText>,it is working but the changes made to Serial Number field are not saved.

Please help me!


Controller:

public with sharing class receivecont2 {
Purchase_order__c po;
Product_serial__c[] psl;
    public receivecont2(ApexPages.StandardController controller) {
this.po = (Purchase_order__c)controller.getRecord();               
 
     this.psl = [ SELECT
       d.Name,d.product_disp__c,d.received_quantity__c,d.Serial_Number__c
            FROM
      Product_serial__c d
      WHERE
       d.purchase_order__c = :po.id];
    }
     public pagereference saveChanges() {
  upsert this.psl;
return null;  
 }
          public pagereference newRec() {
  Product_serial__c d = new Product_serial__c();
  d.Purchase_order__c =this.po.id;
 psl.add( d );
  return null;
 }
public Product_Serial__c[] getRecs() {
  return this.psl;
 }
}

 

 

Visualforce page:


<apex:page standardController="Purchase_Order__c" extensions="receivecont2">
<apex:form >
 <apex:messages />

 <apex:sectionHeader title="Please enter Product Serials " />
 <apex:pageBlock >
  <apex:pageBlockButtons location="bottom">
   <apex:commandButton action="{!saveChanges}" value="Save"/>
       <apex:commandButton action="{!cancel}" value="Back" />
  </apex:pageBlockButtons>
  <apex:pageBlockTable value="{!Recs}" var="test">
  <apex:column value="{!test.Product_disp__c}"/>
   <apex:column value="{!test.Received_Quantity__c}"/>
     <apex:column >

      <apex:inputField value="{!test.Serial_Number__c)"/>
    </apex:column>

    
    
  </apex:pageBlockTable>
 
   
 </apex:pageBlock>
</apex:form>
  </apex:page>

 

Best Answer chosen by Admin (Salesforce Developers) 
emuelasemuelas

The problem was this:
<apex:inputField value="{!test.Serial_Number__c)"/>

Instead of a curly bracket },there was ')'.

All Answers

Imran MohammedImran Mohammed

What error are you getting when you save the record using apex:inputField?

emuelasemuelas
Hi Imran, The error I am getting is : Visualforce Error:value for inputField is not a dynamic binding whereas if i change to inputtext,there is no error but the values are not saving
Imran MohammedImran Mohammed

Can you make sure whether the serial_number__c field is a read only field?

I feel that the field is a read only field.

emuelasemuelas

Hi Imran,

 

I have checked the field accessibility ,its editable and is a text field....

Imran MohammedImran Mohammed

Can you check this?

Use apex:inputText and use the system.debug to log the value of Serial_number__c prior you call upsert statement in saveChanges action.

Let me know what you see in the debug logs.

 

emuelasemuelas

Hi Imran,

 

Iam not sure how to add this :

 

System.debug('test: ' +Product_serial__c.Serial_Number__c);

 

 

and then i try and save a value in the input text

 

and meanwhile i check the system log.

13:02:14.993|METHOD_ENTRY|[15]|System.debug(ANY)
13:02:14.993|USER_DEBUG|[15]|DEBUG|test: Serial_Number__c
13:02:14.993|METHOD_EXIT|[15]|System.debug(ANY)
13:02:14.993|DML_BEGIN|[16]|Op:Upsert|Type:Product_Serial__c|Rows:6
13:02:15.018|DML_END|[16]
13:02:15.022|CODE_UNIT_FINISHED|receivecont2 invoke(saveChanges)

 

I hope iam using system debug correctly the way you want me to...

Imran MohammedImran Mohammed

Did you enter Serial_Number_c in the inputText  field there?

Are the other values other than Serial_Number__c getting saved?

emuelasemuelas

Hi Imran,

 

Tried entering the serialnumber ,but not working.

Tried with other fields as input text ,this s not working too

 

And like before the <apex:inputField > tag is not working

emuelasemuelas

The problem was this:
<apex:inputField value="{!test.Serial_Number__c)"/>

Instead of a curly bracket },there was ')'.

This was selected as the best answer
Imran MohammedImran Mohammed

Good to see you finally resolved it.