5

I have <apex:commandbutton> in a repeat section. I want that when submit is peformed of a single section it does not encounter the validations of other sections, so I am using immediate = true. The problem I am facing is my data does not post on server.

<apex:repeat value="{!listVal}" var="record"/>
  <apex:repeat value="{!Fields}" var="f">
    <apex:inputField value="{!record[f]}" required="{!OR(f.required,f.dbrequired)}" />
  </apex:repeat>

 <apex:commandbutton value="submit" action="{!save}" immediate="true" />    
</apex:repeat>   

I have checked, and i found that it is the behaviour of which does not allow to post data to server. How should I implement this?

1 Answer 1

9

Well Pankaj whenever you are setting immediate="true" for a command button the validations along with the setter for the fields doesnt fire and hence data is not posted to server/controller.

You can also try to enclose sections inside <apex:ActionRegion> this will allow you submit the corresponding section to the server.

Something like this probably

<apex:repeat value="{!listVal}" var="record"/>
    <apex:ActionRegion>
      <apex:outputPanel id="panel">
          <apex:repeat value="{!Fields}" var="f">
            <apex:inputField value="{!record[f]}" required="{!OR(f.required,f.dbrequired)}" />
          </apex:repeat>

            <apex:commandbutton value="submit" action="{!save}" rerender="panel" />
     </apex:outputPanel> 
   <apex:ActionRegion>
</apex:repeat>
3
  • what should i do now?
    – Pankaj
    Commented Feb 16, 2013 at 8:32
  • @Pankaj updated the answer.
    – Avidev9
    Commented Feb 16, 2013 at 15:41
  • 3
    These days you can also use multiple <apex:form>s to achieve the same effect as the action regions.
    – Matt Lacey
    Commented Feb 18, 2013 at 23:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .