2

This is my first question. I have some doubts about one trouble. I saw that it could be there a duplicate question, but i'll try anyways.

My vf page code is below:

<apex:form >
   <apex:pageblock >
    <apex:pageBlockButtons >
    <apex:commandButton value="Cancelar" action="{!cancelar}" />
    </apex:pageBlockButtons>
   <apex:pageBlockSection>
    <apex:repeat value="{!mapaCantProductos}" rendered="{!IF(tempListaInnerProd.size != 0,true,false)}" var="ipId">
     <apex:repeat value="{!mapaCantProductos[ipId]}" var="oli">
        <apex:inputField value="{!oli.UnitPrice}" label=""/>
        <apex:inputField value="{!oli.serviceDate}" label="" required="true" />
      </apex:repeat>
     </apex:repeat>
    </apex:pageBlockSection>
   </apex:pageblock>
  </apex:form>

And the controller code is:

 public PageReference cancelar(){
    PageReference pf = new PageReference('/'+this.opp.Id);
    pf.setRedirect(true);
    return pf;
 }

Then when i try to click on it, an inputField required error is displayed: "Must write a value" or something like that. I could read some about apex:ActionRegion tags to split up the form into various groups of fields with their associated actions.

My inputFields within apex:form and apex:pageBlock are below:

 <apex:inputField value="{!oli.serviceDate}" label="" required="true" />

Thanks in advance, any help to handle this situacion will be helpful.

  • Can you add more code; that will be helpful. – Ganesh Bhosle Dec 6 '13 at 5:15
  • Added the entire form. the problem is when i do click on "Cancelar" button only i have to back to other page. But the actual page it doesn't let me "go back" (pageReference) because it says me that i must to enter a value although the row is empty. – mauriD Dec 6 '13 at 5:38
  • r u submitting form without entering any value in 'oli.serviceDate'? – Ganesh Bhosle Dec 6 '13 at 5:44
  • Yep! I'm submitting, but the target of that Submit is only go to the "opportunity" page, meaning go to the previous page – mauriD Dec 6 '13 at 5:47
  • set default value to the field 'serviceDate'. It will work. – Ganesh Bhosle Dec 6 '13 at 5:52
1

set default value to the field 'serviceDate'.

OR

set immediate="true"

  • immediate="true" should be the way to go here, setting this means it will bypass all validations and carry out the postback action. – VarunC Dec 6 '13 at 7:48

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.