You need to sign in to do that
Don't have an account?
swethasfdc
Not returning an integer from apex page to visualforce page
When I tried to return an integer value from apex page to a visualforce page,It is not allowing integer values in my action button method.It was taking only string and pagereference values.Why is it so???
When i am using string.valueof(integer) and converting into string only it was able to go through the apex to VF.
The return value of an action function is used to redirect the browser to a new page. This means that it makes no sense to return a date, integer, boolean, or any other value that is not a String or PageReference. If you want a value from a function to be put into your page, use an accessor function instead. They take the following forms:
The former method allocates space for myNumber1 inside the view state, and can be modified by any function, even your action function. The latter method returns a hypothetical value (aNumber), which could be any variable in scope that is an Integer, or even the results of a calculation or query.
To access a value obtained by these means, you could use a number of different methods:
There's other ways to accomplish what you're trying to do.
All Answers
The return value of an action function is used to redirect the browser to a new page. This means that it makes no sense to return a date, integer, boolean, or any other value that is not a String or PageReference. If you want a value from a function to be put into your page, use an accessor function instead. They take the following forms:
The former method allocates space for myNumber1 inside the view state, and can be modified by any function, even your action function. The latter method returns a hypothetical value (aNumber), which could be any variable in scope that is an Integer, or even the results of a calculation or query.
To access a value obtained by these means, you could use a number of different methods:
There's other ways to accomplish what you're trying to do.
Thanks for ur reply, I got ur answer.
Can i know when and why we use the rerender and oncomplete.
rerender = if you want to "refresh" a particular section of the VF page via AJAX on completion of your action method.
oncomplete = if you want to fire off some Javascript code on completion of the action method.
-Andy