1

i'm trying populate the fields of a custom Object. The object are being create but the informations used with InputField doesn't populate.

Fragment of Visualforce

<apex:actionRegion id="formNewSolicitud" immediate="false" rendered="{!grid}">
  <apex:outputLabel value="{!$ObjectType.Socitud__c.Fields.Tipo__c.Label}" for="inputTipo"/>
  <apex:inputField id="inputTipo" value="{!newSocitud.Tipo__c}" required="true" /> 
  <apex:outputLabel value="{!$ObjectType.Socitud__c.Fields.Comentarios__c.Label}" for="inputComentarios"/>
  <apex:inputField id="inputComentarios" value="{!newSocitud.Comentarios__c}" required="true" /> 
  <apex:outputPanel layout="none">
  <apex:commandButton value="Salvar" action="{!saveSolicitud}"/>
  </apex:outputPanel>
</apex:actionRegion>

Controller

 public class TLS_CallClosureController {

public Socitud__c newSocitud {get; set;}


public TLS_CallClosureController() {
    newSocitud = new Socitud__c();
  } 

public PageReference saveSolicitud(){  
        upsert (newSocitud);
        return null;
    }

I tested inserting hardcored and worked, but when i use the inputField in Visualforce the object doenst populate.

thanks in advance.

5
  • 1
    Do you have an apex:pageMessages in your page? That would display any errors that are stopping the upsert from completing.
    – Keith C
    Jun 12, 2015 at 20:20
  • Hello Keith, the object are being created correctly, because has a field autonumber(id), so not will appear an error message
    – Carlos
    Jun 12, 2015 at 20:33
  • I see you are using Action region, Any specific requirement ? You can try to remove it and check if its working. In Action Region only specific data is sent to server. Jun 12, 2015 at 20:39
  • @Carlos Fine if there are no errors. But a year from now someone could add some validation that will cause your page to silently fail unless you include the apex:pageMessages.
    – Keith C
    Jun 12, 2015 at 21:10
  • @Jintendra, yes. 'Cause i am opening a grid to insert these info. after they'll close and reload the page with the info that was filled. I'll try remove the Actionregion, if works i'll post the answer.
    – Carlos
    Jun 12, 2015 at 22:32

1 Answer 1

2

the problem was rendered="{!grid} (as false).

@Bob_buzzard said:

Is your inputfield rendered the first time that you access the page? If not, then you won't be able to make it appear through rerendering, as you can't rerender something that isn't present. You have to wrap the conditionally rendered item in a container (e.g. outputPanel) that is rendered in all cases.

solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.