Sign in to Community
Sign in to view all badges
I am creating a custom widget for a client. It is a slider with a 'n/a' checkbox.
The slider works fine, and I can see that the '_value' attribute on the guidestate is set to the value from the slider.
However, I would like to also send the status of the n/a checkbox on submit also. I could save it to the _value field as well and add code to handle 'n/a' differently...but that seems messy.
Is it possible to set a different attribute other than _value on a custom widget? Perhaps a new field such as isNotApplicable
I couldn't get this to work. My client's requirements changed so I didn't need to do this in the end.
It would be useful for other people however if you had a small example of how to do this. Maybe something simple, like 1 widget that has two textboxes?
James R Green, were you able to get this to work? Please let me know in case you need any further help.
AEM Forms Blog
Thanks I will check this out!
What I would suggest is that you create a guideCompositeWidget, much like the fileupload or TnC box. The only difference is you should be using custom widgets instead of the OOTB widgets.
Hope this helps!!!
smacdonald2008 - Are you able to query this with the dev team please?
The use case I have is to add more than one value entered by a user from a custom widget to the guide state.
The problem I have is I can only set "_value" via the getCommitValue of my custom widget, in total I need to store 3 values:
1) The value of the range slider (1-100)
2) A comment from a textbox within the same widget
3) The value of a radio button to say if the question is N/A
The custom widget easily allow me to store one of these values, but I cannot see an easy way to store multiple/custom values.
Workarounds that I have tried so far include:
1) Representing 'N/A' as -1 value on the slider - this worked but doesn't cater for the comments.
2) I can store a stringified JSON object in _value containing all 3 values, and parse it in getOptionsMap. This works, but is pretty hacky.
Ideally I would have an example that shows how I can add custom properties to the guidestate e.g.
"_value": "Value from the slider".
"comment":"Text entered in the comment textbox"
Still required. Can anyone help?
Still require help with this one. Any suggestions? Even confirming it is not possible would be useful