2

I have a page in which it has a lookup field. When you fill the box for the look up field onBlur() it will check to see if that lookup field exists and if it does it will change the text of a output text for a description of the relevant data for it.

Currently i have jquery get the value from the inputtext then send that to an actionfunction that runs mymethod. The problem i am having is that whenever it runs the function it seems like it posts to the server but the error messages are suppressed and content is no longer being loaded dynamically.

for eg. A required field isn't filled it will show a VF_PAGE_MESSAGE according to debug logs but not visually because no rerender, and effectively stop the JS from working.

Is anyone aware of some better practices for me to use because this one simply isn't working.

1 Answer 1

1

There can be several possible reasons:

One of them can be is you have a required lookup field and it is bound with onblur() so if that field is left without entering any value it calls actionfunction passing an empty value which causes page validation to fail. So for this you can add logic to check if the value is empty e.eg;

if($("#field").val()!=null) 
{ 
   // call action function 
}

Another reason can be is when actionfunction called it has some other required fields values with lookup field to post which causes page validation to fail due to other field. Solution for this is use <apex:actionreigon> tag and include that lookup field inside the <apex:actionreigon> and set renderRegionOnly="true"

ex:

<apex:actionReigon renderRegionOnly="true">
   <apex:inputField value="{!someLookup.ref}"/>
</apex:actionReigon>
<apex:inputField value="{!otheValues}"/>

You can see a good example here

1
  • Thanks, that is what is happening, that when an onblur event triggers all the other required fields have yet to be filled, so it validates the page and it fails to send responses to the action function.
    – James
    Commented Feb 20, 2014 at 16:02

You must log in to answer this question.

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