Expand my Community achievements bar.

SOLVED

AllowBlank false not works

Avatar

Level 2

Hi All,

I want to add AllowBlank for next form:

<script type="text/javascript">CQ.Util.build({xtype: 'panel',border: false,cls: 'entry-fields-wrap',layout: 'form',defaults: { hideLabel: true},items: [ {xtype: 'textfield', defaultValue: 'Entry title', cls: 'title', name: 'title', fieldLabel: 'Entry Title', hideLabel: false, width: '100%'            }, {xtype: 'textfield', defaultValue: 'Browser title', cls: 'browserTitle', name: 'browserTitle', fieldLabel: 'Browser Title', hideLabel: false, fieldDescription: 'This title appears in the top bar of the browser window itself', width: '100%'            }, {xtype: 'pathfield', rootPath: '/content/', cls: 'titleImage', name: 'titleImage', fieldLabel: 'Title Image', hideLabel: false, width: '100%', allowBlank: false, }, {xtype: 'button', 'text': 'Save Entry','handler': function() {CQ.social.blog.Util.validateEntryForm('${entryForm.id @ context="unsafe"}'); } } ],'renderTo': '${entryForm.id @ context="unsafe"}_fields_wrap'    });</script>

 

But when image field is empty and  i click on Save Entry button - Entry will be created - its wrong

Please help - This is the standard library - what can I do to make it work?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Maria,

Yes, but instead of show, you would do your usual beforesubmit validation:

beforesubmit="function(dialog){ return custom.maria.validation(dialog);}"

Regards,

Peter

View solution in original post

5 Replies

Avatar

Level 10

can you post a screenshot please - it will help figure out whats going on. 

Avatar

Level 2

I removed several fields. The form is as follows:

When i click on Save Entry button and image field is empty - Entry will be created

Avatar

Community Advisor

Hi Maria,

Kind of a workaround, that worked for similar task,

You can make your top level entry dialog and perform validation in the listeners area.

If validation is not OK, you can always prevent dialog from submitting and show error message.

Have a look at /libs/dam/components/youtube/channelconfig/channelconfig.jsp for an example of implementing a listener.

Regards,

Peter

Avatar

Level 2

Do you mean something like this?

listeners: { show: function() { var tf = dialog.getField("cq:tags"); snapshot = tf.snapshot(); } }

Avatar

Correct answer by
Community Advisor

Hi Maria,

Yes, but instead of show, you would do your usual beforesubmit validation:

beforesubmit="function(dialog){ return custom.maria.validation(dialog);}"

Regards,

Peter