AllowBlank false not works | Community
Skip to main content
Maria_Pushkina
Level 2
August 17, 2016
Solved

AllowBlank false not works

  • August 17, 2016
  • 5 replies
  • 2247 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Peter_Puzanovs

Hi Maria,

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

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

Regards,

Peter

5 replies

smacdonald2008
Level 10
August 17, 2016

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

Maria_Pushkina
Level 2
August 18, 2016

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

Peter_Puzanovs
Community Advisor
Community Advisor
August 18, 2016

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

Maria_Pushkina
Level 2
August 18, 2016

Do you mean something like this?

listeners: { show: function() { var tf = dialog.getField("cq:tags"); snapshot = tf.snapshot(); } }
Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
August 18, 2016

Hi Maria,

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

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

Regards,

Peter