This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Portals and Portlets and the fly likes Java Script Reference to JSF components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Java Script Reference to JSF components" Watch "Java Script Reference to JSF components" New topic

Java Script Reference to JSF components

vaitheeswaran subramanian

Joined: Jan 06, 2005
Posts: 15
I am using JSF Portlet for my portlet project. I am not able to refer to the value of the faces fields through my java script.
This is the form I have
<h:form id="form1" styleClass="form">
<td align="left">UserName:</td>
<td style="width:5px"> </td>
<td><h:inputText id="textUserName1"
value="#{userInfoBean.userName}" styleClass="inputText">
<td align="left">Password:</td>
<td style="width:5px"> </td>
<td><h:inputText id="textPassword1"
value="#{userInfoBean.password}" styleClass="inputText">
<hx:commandExButton id="button1" styleClass="commandExButton"
type="submit" value="Submit">
<hx:behavior event="onclick" onActionFunction="return #{facesContext.externalContext.response.namespace}func_4(this, event);"></hx:behavior>

My question is how would I get the values for text fields textUserName1 & textPassword1 in the java script function func_4(this, event) called when clicking the submit button?
I agree. Here's the link:
subject: Java Script Reference to JSF components
Similar Threads
disabled issue for inputtext
Foreign key field population from datatable to textbox?
Can not Populate the form on combo box change
Can't get c:import to work
JSTL and bean data