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".
Help link: https://myprogressivelearning.wordpress.com/2015/01/21/setting-default-value-to-the-drop-down-of-dialog-in-adobe-aem-cq5/
Code will be similar to
- function(dialog){
- x= dialog.findParentByType('dialog').getField('./vocLevel');
- if(x.getValue()=="")
- x.setValue("N/A");
- }
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