Question

i am not able to invoke a function in my javascript. i used to invoke the function inthe script.can u suggest me the way to accomplish my task? my code as below

Thank You For Registering

<h:panelGrid columns="2" id="panel1">
<h:outputText value="user name" ></h:outputText>   
<h:inputText id="userName" value="#{login1.userName}"  required="true">
</h:inputText>

<h:outputText value="password"></h:outputText>
<h:inputSecret id="password" value="#{login1.passWord}">
</h:inputSecret>

<h:outputText value="confirmPassword"></h:outputText>
<h:inputSecret value="#{login1.passWord}">
</h:inputSecret>
</h:panelGrid>

<h:panelGrid columns="2" id="panel2">
<h:commandButton id="submit" value="submit" 
action="#{login1.insertNewUser}"     onclick="test()" ></h:commandButton>
</h:panelGrid>

<h:panelGrid >
<h:outputLabel >do u want to check once?</h:outputLabel>
<h:commandLink id="link" action="login" disabled="true">Login</h:commandLink>
<h:outputScript name="UI/script.js" ></h:outputScript>
</h:panelGrid>



</h:form>

my javascript:script.js

function test(){
var link=document.getElementById("myform:link").getAttribute("disabled");
alert(link);
alert("hi");
} 

nothing showing with this . i am using jsf2.o. i am thankful to you for any response in advance

Était-ce utile?

La solution

script.js must be inside /webapp/resources/UI/ or /war/resources/UI/ or whatever. And use as <h:outputScript library="UI" name="script.js" />

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top