This content has been marked as final.
Show 3 replies
-
2. Re: How to set cursor focus to <h:selectOneRadio> during onload?
eswaramoorthy1985 Jun 17, 2010 6:20 AM (in response to eswaramoorthy1985)Hi,
<h:form id="focusForm" > <h:selectOneRadio id="testRadioId" value=""> <f:selectItem id="si1" itemLabel="JSF" itemDisabled="true"/> <f:selectItem id="si2" itemLabel="JSP" /> </h:selectOneRadio> </h:form>
Suppose, i set the itemDisabled attribute is dynamically changed or false .
This time not set cursor focus to first radio filed, when i use the following script.
document.getElementById("focusForm:testRadioId:0").focus();
Because the first radio field is disabled.
How can i set cursor focus here?
Help me about this.
I am waiting for your all support.
-
3. Re: How to set cursor focus to <h:selectOneRadio> during onload?
eswaramoorthy1985 Jun 18, 2010 6:06 AM (in response to eswaramoorthy1985)Here i use jquery two way.
The first one is work. But the second is not worked.
First, The follwoing code is worked.
<a4j:loadScript src="resource://jquery.js"/> <script type="text/javascript"> function setFocusRadioField() { jQuery(':input:visible:enabled:first').focus(); } </script> <body onload="setFocusRadioField();"> </body>
Second,
the following code is not worked. I test the following way:
jQuery('#focusForm\:testRadioId:enabled:first').focus();
Then,
jQuery('#focusForm\\:testRadioId:enabled:first').focus();
Then
var id = "#focusForm:testRadioId:enabled:first".replace(/:/g, "\\:"); jQuery(id).focus();
I need set cursor focus using id. I don't know where i make mistake using second way.help me about this.
Thanks in advance.