0

I have the following code in XHTML:

<h:inputText value="#{SearchAction.lat}" id="lat">
            <f:ajax event="valueChange"  listener="#{SearchAction.findAddress}"/>
</h:inputText>

If I change the content of the input field, the listener gets called correctly.

However, on page load I call a javascript function that populates the input field with a new value and I could see the input field being populated but the ajax request doesn't get sent to the server.

Is there a distinction between user-provided values and javascript provided values?

-Majid

1 Answer 1

1

You need to programmatically invoke the change event afterwards in JS.

inputElement.change();
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks BalusC. Here is How I invoked the event: var elem = document.getElementById("search_form:lat"); if (typeof elem.onchange == "function") { elem.onchange.apply(elem); }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.