Forums Register Login

Can't get innerHTML from inputText

+Pie Number of slices to send: Send
I'm trying to set up a a web page so that, when the user hits the Tab key to exit an inputText field, it saves that value to the backing bean. The application uses JSF 1.2, Richfaces 3.3.3, and the dojo JS framework. Here's a snippet of my code:




The problem is that the javascript function getting called isn't getting what I enter into the box. When I show it on the console, it's just blank. I've double-checked using FireBug to make sure that the ID I'm using in the dojo.byId statement is correct, and the syntax of the dojo.byId is correct. Any help would be great.
+Pie Number of slices to send: Send
figured this out. Just in case anybody else comes across this, instead of using:



use:

+Pie Number of slices to send: Send
You are a glutton for punishment. I used dojo/dijit on a system about 18 months ago, blew a lot of time, and ended up having to work for free for several weeks. It didn't help any that dojo had temporarily fallen out of favor so help was rather scarce.

Personally, I've had better look with jQuery, but YMMV.

In any event, raw javascript is the hard way here, even when assisted by frameworks like dojo. JSF 1.2 supports AJAX. Instead of coding it all up by hand, doing an AJAX update of the selected property should be simpler.
+Pie Number of slices to send: Send
thanks for the info. I'm not the biggest fan of dojo either, but we're already using the ArcGIS mapping system, which comes with dojo packaged in, so I figured it's better to try and use that than import another framework. I've never used JQuery more than just playing around with it, but it does seem superior. Hoping I can use it on our next project.
+Pie Number of slices to send: Send
You may be interested to know that you're already using jQuery! I see in your example that you've got a4j (RichFaces) jsFunction. RichFaces uses jQuery to do its AJAX functions. It's not the absolute latest version of jQuery, but it's enough to get by. You don't even have to explicitly request it. The only caveat is that you can't use the "$" notation, since that confuses JSF's EL processor (use the "jQuery." form instead).

Incidentally, using RichFaces, this will update a backing bean property without any javascript on your part at all:


Live production code will often also include reRender options and an action method to be fired when the property updates.
+Pie Number of slices to send: Send
I didn't know that. I'm gonna try that out today, because that's definitely easier than how I'm doing it. I'll let you know how it works!
That is a really big piece of pie for such a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3535 times.
Similar Threads
display a gmaps4jsf map in rich:modalpanel
Richfaces + jsFunction + radioButton
A Javascript function is said as "Not a function"
Calling a4j: jsFunction from a .js file
Can we pass the rich element to JSFunction?
Thread Boost feature
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:17:32.