Hi
I have the following textfield:
<vocLevel
jcr:primaryType="cq:Widget" value="{String}N/A" defaultValue="{String}N/A" fieldLabel="VOC Level" name="./vocLevel" xtype="textfield" />
If field's value is removed by conent author, how to populated it with 'N/A' value after content author submits dialog?
Thank you in advance.
Solved! Go to Solution.
You can use a listeners "loadcontent", which will execute when dialog is open. 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
function(dialog){ x= dialog.findParentByType('dialog').getField('./vocLevel'); if(x.getValue()=="") x.setValue("N/A"); }
You can use a listeners "loadcontent", which will execute when dialog is open. 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
function(dialog){ x= dialog.findParentByType('dialog').getField('./vocLevel'); if(x.getValue()=="") x.setValue("N/A"); }
This component cnfiguration solved my case <vocLevel jcr:primaryType="cq:Widget" emptyText="{String}N/A" fieldLabel="VOC Level" name="./vocLevel" xtype="textfield" />