{"id":317,"date":"2022-08-30T14:59:20","date_gmt":"2022-08-30T14:59:20","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/10\/23\/problem-about-required-field-record-and-share-programming-errors\/"},"modified":"2022-08-30T14:59:20","modified_gmt":"2022-08-30T14:59:20","slug":"problem-about-required-field-record-and-share-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-required-field-record-and-share-programming-errors\/","title":{"rendered":"problem about required-field-Record and share programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fcdaa233771f8678fc6e261bb69446c1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJonas<br \/>\nforms extjs extjs4 required-field<br \/>\nI have this problem where I need to add a red asterisk beside a fieldLabel when a field is marked as &#8220;required&#8221; (or allowBlank: false)In ExtJS3, we can have this hack easily by overriding Ext.layout.FormLayout as follow:Ext.override(Ext.layout.FormLayout, {getTemplateArgs: function(field) {var noLabelSep = !field.fieldLabel || field.hideLabel;var labelSep = (typeof field.labelSeparator == &#8216;undefined&#8217; ? this.labelSeparator : field.labelSeparator);if (!field.allowBlank) labelSep += &#8216;*&#8217;;return {id: field.id,label: field.fieldLabel,labelStyle: field.labelStyle||this.labelStyle||&#8221;,elementStyle: this.elementStyle||&#8221;,labelSeparator: noLabelSep ? &#8221; : labelSep,itemCls: (field.itemCls||this.container.itemCls||&#8221;) + (field.hideLabel ? &#8216; x-hide-label&#8217; : &#8221;),clearCls: field.clearCls || &#8216;x-form-clear-left&#8217;};} });But this is impossible in ExtJS4. FormLayout is no longer applicable, and labels are in fact rendered by Ext.form.field.Base by using a mixins call<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-10-23 19:28:14. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Jonas forms extjs extjs4 required-field I have this problem where I need to add a red asterisk beside a fieldLabel when a field is marked as &#8220;required&#8221; (or allowBlank: false)In ExtJS3, we can have this hack easily by overriding Ext.layout.FormLayout as follow:Ext.override(Ext.layout.FormLayout, {getTemplateArgs: function(field) {var noLabelSep = !field.fieldLabel || field.hideLabel;var labelSep = (typeof field.labelSeparator == [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-317","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=317"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/317\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}