Skip to main content
Maria_Pushkina
Level 2
Aug 17, 2016 2:13 PM UTC
Solved

AllowBlank false not works

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.
Peter_Puzanovs
Peter_PuzanovsAccepted solution
Community Advisor
Aug 18, 2016 2:14 PM UTC

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
Aug 17, 2016 8:44 PM UTC

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

Translate
Maria_Pushkina
Level 2
Aug 18, 2016 6:48 AM UTC

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

Translate
Peter_Puzanovs
Community Advisor
Community Advisor
Aug 18, 2016 9:31 AM UTC

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

Translate
Maria_Pushkina
Level 2
Aug 18, 2016 1:45 PM UTC

Do you mean something like this?

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

Hi Maria,

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

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

Regards,

Peter

Translate