1

When I click on the hx:commandExButton the Javascript function should get called, but it is not getting called. The Javascript function is as follows:

function test() {
    alert('ss');
    return  "true";
}

The hx:commandButton is as follows:

<hx:commandExButton
    type="submit"
    value="Search"
    styleClass="action2" id="searchButton"
    onclick="return test();"
    action="#{pc_WorkInProgressUserGrid.doSearchButtonAction}"
    immediate="true">
</hx:commandExButton>

Any suggestion would be helpful.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Suresh
  • 38,717
  • 16
  • 62
  • 66
  • Where does this component `commandExButton` comes from? – Romain Linsolas Apr 01 '10 at 12:22
  • What is the actual HTML output of this? – jhurshman Apr 01 '10 at 12:34
  • @romaintaz: It comes from the IBM Faces Client Framework. A buggy and poorly documented JSF component library which is included in WSAD/RAD. – BalusC Apr 01 '10 at 13:30
  • hello Everyone , i am developing a school project ,in that there is a jsp page and this jsp page has table with 2 columns onpage load begin of this jsp first column will be populated with list of teachers question here is this included jsp will have 3 columns one column has name of the class second column has number of students attended yesterday and third column will have text box to enter number of students attended todays class here the number classes a teacher handles per day is different for every teacher can some please help me how to create a dynamic table in the included JSP – Suresh Mar 21 '11 at 11:29

2 Answers2

3

First step would be to check the generated HTML output to verify if it looks right. It may for instance happen that the hx:commandExButton itself didn't take the onclick attribute value correctly into account. As a test, you could try to get rid of it and use the standard JSF h:commandButton instead.

Further I also recall something about a crazy <hx:scriptCollector> tag which you are supposed to wrap the piece of JSF code with whenever you'd like to use Javascript in combination with IBM Faces Client components.

E.g.

<hx:scriptCollector id="someid">
    <hx:form>
       <hx:commandExButton />
    </hx:form>
</hx:scriptCollector>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
0

I don't know JSF, but it's immediately obvious that you have omitted a " after true, and also a >

Are those ** supposed to be there? And writing method before a function is definitely not part of standard JavaScript.

aaaaaaaaaaaa
  • 3,630
  • 1
  • 24
  • 23