0

i have jsf datatable in which javascript function not working, i called inputTextChanged() in javascript from datatable but its not working...

        <h:dataTable value="#{order.orderList}" var="o" id="table_Details" >  
            <h:column> 
                <h:inputText value="#{o.productName}"    id="proname" name="proname"   onchange="inputTextChanged()" />
            </h:column> 
            <h:column>  
                <h:inputText value="#{o.price}"   id="proprice" name="proprice"   onchange="inputTextChanged()" /> 
            </h:column>  
        </h:dataTable> 

and javascript

      function inputTextChanged()
    {  
        alert ('Event Fired');
    }
Boopathi
  • 226
  • 1
  • 4
  • 18
  • 1
    check your browser console, do you see some error like *no such function inputTextChanged* or some other error ? cause you probably placed the function in the wrong location... – Daniel Aug 19 '13 at 11:12
  • @Daniel yeah it's showing error like, ReferenceError: inputTextChanged is not defined – Boopathi Aug 19 '13 at 11:31
  • place that function in a js file and include it, read more : http://stackoverflow.com/questions/11988415/what-is-the-jsf-resource-library-for-and-how-should-it-be-used – Daniel Aug 19 '13 at 11:49

1 Answers1

0

Place your code in some js file, for example myFile.js, then place that file in resources folder, under the root of your web application (same folder level with WEB-INF) and include it in your page in the following way:

<h:outputScript name="js/myFile.js" />

Read more here: What is the JSF resource library for and how should it be used?

Community
  • 1
  • 1
Daniel
  • 36,833
  • 10
  • 119
  • 200