Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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>
share|improve this answer
    
what should i do now? –  Pankaj Feb 16 '13 at 8:32
    
@Pankaj updated the answer. –  Avidev9 Feb 16 '13 at 15:41
    
hey thanks it works now –  Pankaj Feb 18 '13 at 11:37
1  
These days you can also use multiple <apex:form>s to achieve the same effect as the action regions. –  LaceySnr Feb 18 '13 at 23:19
    
ok @LaceySnr .Thanks for the info. –  Pankaj Feb 19 '13 at 5:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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