我正在尝试使用Java脚本方法更新primefaces 6.2中的UI文本字段.虽然我可以从UI端更新值,但它并没有反映在支持托管bean上
I am trying to update an UI text field in primefaces 6.2 using java script method. Though I am able to update the value from UI side, it is not reflecting in backing managed bean
Xhtml:
<h:inputHidden id="test" value="#{mybean.fieldname}" valueChangeListener="# {mybean.method}"> <f:ajax/> </h:inputHidden>JavaScript:
Javascript:
function update(){ document.getElementByID('form:test').value="change"; alert(document.getElementByID('form:test').value); }我希望自从我更新值以来,我的值更改处理程序会被调用,但是什么也没有发生.有人可以告诉我哪里出了错
I expect my value changehandler to get called since I updated my value but nothing occurs.can some one pls tell where I am getting wrong
实际上,我试图将使用Js从UI端更改的值提交到实际的bean值,基本上是单独更改dom,并且尝试使用任何ajax调用提交相同的值.但仍然无法正常工作.引用了此链接:何时使用valueChangeListener或f:ajax监听器?能否请一些人对如何实现这一目标提供一些见解?
Edit :Actually I am trying to submit the value changed from UI side alone using Js to the actual bean value, basically dom alone is changed and kind of trying to submit the same using any ajax calls. but still it is not working. Refered this link:When to use valueChangeListener or f:ajax listener? Can some one pls give some insights on how this can be achieved?
推荐答案如果通过JavaScript设置值,则必须通过JavaScript显式触发更改事件.
You have to trigger explicitly a change event by JavaScript if you set a value by JavaScript.
更多推荐
从javascript更新UI值未反映在javabean中
发布评论