I used Aheadworks Product question for Magento 2.4.5 and I have a problem for add the cancel button on the question/answer form. This is not functionnaly.
By default I have in vendor/aheadworks/module-product-question/view/frontend/web/template/ui/form.html:
<div if="isDisplayCancel" class="secondary">
<button type="button" click="onCancel" class="action action-cancel"><span translate="'Cancel'"></span></button>
</div>
and in vendor/aheadworks/module-product-question/view/frontend/web/js/ui/form.js
return Component.extend({
defaults: {
template: 'Aheadworks_Pquestion/ui/form',
formId: '',
formCss: '',
buttonLabel: $t('Submit'),
isDisplayCancel: false,
isVisible: true,
isNeedToRender: true,
additionalDataFormPartSelectorList: []
},
I have changed isDisplayCancel on “True”. My Cancel Button show on my form now but it does nothing, the function onCancel is empty in form.js
/**
* Cancel event
*/
onCancel: function () {
},
How to do to hide the form with a click button and show add answer/question again? Should I use knockout JS necessary? I try with jQuery but not success, the form hiding and add question/answer button is show again but it didn’t work anymore.
Thanks if you can help me.