You need to sign in to do that
Don't have an account?
Zack Thomas
Update apex list from client side
Is there any way to update a list managed and loaded from a server-side visualforce controller via javascript? Obviously I can extend the drop down on the client side that is attached to the list, but on post back it errors off saying the value is not valid.
Thanks!
Zack
I have had the same issue before. I posted it here (http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=12337) but is unanswered till date. I don't think SF currently has any support for dynamic options for server components. The options that I have in mind are discussed below:
1. My requirement was that of a multiselect list with dynamic options being sent to the server. So I load an HTML select list with the options from vf controller, do all the javascript manipulations of the options at the client side, then send the updated list of selected options as a delimited string in a hidden variable back to the server, where I parse it and extract the desired values. If data is huge, then String datatype maxlength limit (which is probably 32000 chars) has to kept in mind.
2. Another option you might want to consider is using YUI Autocomplete components, which are fairly easy to integrate with VF pages. You just need to build a data source (http://developer.yahoo.com/yui/datasource/) and bind it to the Autocomplete control (http://developer.yahoo.com/yui/examples/autocomplete/index.html). If the data source is JS based, it can be manipulated as you like and the selected value can be sent back to the server in a hidden variable. Check out the related examples hosted on their site.
AD
--------------------------------------------------------------
Mark it as an accepted solution if it works and help the community.
All Answers
I have had the same issue before. I posted it here (http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=12337) but is unanswered till date. I don't think SF currently has any support for dynamic options for server components. The options that I have in mind are discussed below:
1. My requirement was that of a multiselect list with dynamic options being sent to the server. So I load an HTML select list with the options from vf controller, do all the javascript manipulations of the options at the client side, then send the updated list of selected options as a delimited string in a hidden variable back to the server, where I parse it and extract the desired values. If data is huge, then String datatype maxlength limit (which is probably 32000 chars) has to kept in mind.
2. Another option you might want to consider is using YUI Autocomplete components, which are fairly easy to integrate with VF pages. You just need to build a data source (http://developer.yahoo.com/yui/datasource/) and bind it to the Autocomplete control (http://developer.yahoo.com/yui/examples/autocomplete/index.html). If the data source is JS based, it can be manipulated as you like and the selected value can be sent back to the server in a hidden variable. Check out the related examples hosted on their site.
AD
--------------------------------------------------------------
Mark it as an accepted solution if it works and help the community.