3

I have an input number and a button which performs an action on the input, and it is working nicely:

<apex:input type="number" value="{!addCount}"/>
<apex:commandButton action="{!addRows}" value="Generate Participants" rerender="messages, documents"/>

Now I would like to put an onchange into the and remove the buttons.

<apex:input type="number" value="{!addCount}" onchange="addRows"/>
<apex:actionFunction action="{!addRows}" name="addRows" rerender="messages, documents"/>

Why does this not work?

5

You need to actually invoke the function for onchange attributes by using parentheses (()).

No Good

<apex:input onchange="someMethod" ... />

Good

<apex:input onchange="someMethod();" ... />

Note that if you want this event to fire every time you hit a key, you should probably switch from onchange to onkeyup.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.