File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes jsf and javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf and javascript" Watch "jsf and javascript" New topic
Author

jsf and javascript

lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
i have 2 input box whereby the value will be set through javascript. However, im not able to get the update values from the input box.

My jsf code:


to get the value, i tried the following code:
my managed bean code:

when i print out the value for timeInputTxt and dateInputTxt, i get null values.

What have i done wrongly?

-thanks.
Ashraf Abu-Aisheh
Ranch Hand

Joined: Apr 17, 2009
Posts: 88
Hi friend,

First, where is the action here??

I see the type is button, So there is no submit, therefor the code is still in the page and didn't arrive to the managed bean.

Second, if you did the submit in javascript and put the following code in the constructor of your managed bean; The values will be null because the setter method didn't accessed yet:


SCJP 5 - 79%
SCWCD 5 - 100%
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
but if i set to submit, it is submitting the form.. which is what i dont want. I only want the button to trigger a javascript function.

the button will only trigger a javascript that will open up a calendar for the user to select the date and time. Upon selection, the selected date and time will be set to the respective textbox.

i have also tried to do
<a4j:commandButton id="DateBtn" onclick="getDateTime()" type="button" value="Get Date and Time" reRender="dateTxt,timeTxt"/>

but it doesn't work.

Anyone? thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: jsf and javascript