Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set text in Visual JSF textfield from javascript

843844Sep 18 2009 — edited Sep 18 2009
HI,
I want to pass a variable from a javascript to put into a visual jsf textfield that is connected to a Bean variable like this:
<webuijsf:textField id="myLat" style="left: 96px; top: 336px; position: absolute" text="#{CreateNewPage.latitude}"/>

I use this library: xmlns:webuijsf="http://www.sun.com/webui/webuijsf"

I found a guide for this using regular jsf-tags, but that doesn't work for the visual jsf tags. Link: http://balusc.blogspot.com/2009/05/javajspjsf-and-javascript.html

I managed though to change the field to some sort of text by using:

var lat = 'text';
document.getElementById("form1:myLat").textContent = lat;

in my javascript. But this just replaces the textfield to some stand alone text, and the variable in my Bean isn't changed at all. I tried using .value and .text instead of .textContent but it doesn't work. What am I doing wrong here? I'm new to JSF by the way. Thankful for any help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2009
Added on Sep 18 2009
5 comments
270 views