I'm trying to dynamically set the showDatePicker
attribute of an apex input field to get around a strange bug I've been experiencing. I've tried setting attributes using document.getElementbyID('{!component.id}').label="new label"
and nothing seems to change even though the method is called. Do I need to rerender the input field or the panel that it's in for attribute changes to take effect or are they unchangeable after the window loads?
[SalesForce] Can you set a visualforce apex attribute dynamically using javascript
Related Topic
- [SalesForce] How to avoid this JSENCODE() error when the help text is blank
- [SalesForce] SOLVED: Rerendering item in a parallel repeat tag
- [SalesForce] Visualforce pageBlockTable – update values in cells on load
- [SalesForce] VisualForce : Dynamically rerendered inputFields are displaying on page without labels
Best Answer
showDatePicker
is a custom salesforce attribute. So if you want to change it on the page, you will have to assign it with a boolean property value in controller and rerender.Also as per salesforce documentation, it works only in some type of fields,
Label will be a rendering as a different label tag associated with the field. So if you use select field using javascript and change label, it will not change actual label of the field. Use inspect element/browser console to find rendered HTML elements and select accordingly