I have a component where its baked in and have mandatory fields.
when component is authored and later if the components needs to be un authored . It is not switching back to default state and displays previously authored content.
solutions I thought of
1.having a delete can be an option (but it might drive into wrong direction for authors)
2. making fields not required ( it's against business rules ).
Any suggestions apart from what I have mentioned.
Solved! Go to Solution.
Views
Replies
Total Likes
well this is happening because default post servlet is not triggered when validation for dialog fields return false(mandatory fields can't be empty). to over come this you have two options:\
1. create two tabs second tabs will be hidden, first tab will have a check box or radio button to enable or disable the component configuration, second tan will have your component dialog widgets.
one you enable the check box from tab one tab 2 will be enabled and you can configure this as per you requirement. when you don't need this component just select the disable option and this will trigger a listener which will delete the jcr content stored against tab 2 and disable to tab 2 which will allow you to submit the post servlet via default behavior.
2. Alternatively You can use a listeners, which will execute when dialog before submit. In that listener you can write js code to check if value is "" (empty) , the set the value to "N/A".
Code will be similar to
then Don't use NA value to display in your JSP or sightly; using NA will allow you to submit the value successfully.
Regards,
Amit
Views
Replies
Total Likes
well this is happening because default post servlet is not triggered when validation for dialog fields return false(mandatory fields can't be empty). to over come this you have two options:\
1. create two tabs second tabs will be hidden, first tab will have a check box or radio button to enable or disable the component configuration, second tan will have your component dialog widgets.
one you enable the check box from tab one tab 2 will be enabled and you can configure this as per you requirement. when you don't need this component just select the disable option and this will trigger a listener which will delete the jcr content stored against tab 2 and disable to tab 2 which will allow you to submit the post servlet via default behavior.
2. Alternatively You can use a listeners, which will execute when dialog before submit. In that listener you can write js code to check if value is "" (empty) , the set the value to "N/A".
Code will be similar to
then Don't use NA value to display in your JSP or sightly; using NA will allow you to submit the value successfully.
Regards,
Amit
Views
Replies
Total Likes
Hi Amit,
it worked for me what all you have suggested. Thanks a lot.
Views
Replies
Total Likes
i have one more question.
the same scenario applies for all templates except one were baked in component needs to be authored manually meaning the it will be not generated dynamically .
So when i try unauthor it is displaying N/A value(for the template where it is not dynamically generated).
need help here
Views
Replies
Total Likes