{"id":1106,"date":"2013-02-10T16:47:39","date_gmt":"2013-02-10T14:47:39","guid":{"rendered":"http:\/\/hasselba.ch\/blog\/?p=1106"},"modified":"2013-02-10T16:56:43","modified_gmt":"2013-02-10T14:56:43","slug":"quick-n-dirty-disable-all-validators-at-once","status":"publish","type":"post","link":"https:\/\/hasselba.ch\/blog\/?p=1106","title":{"rendered":"Quick-n-Dirty: Disable all validators at once"},"content":{"rendered":"<p>In a larger project there are a lot of forms to fill in, each form has many fields with validators and converters. During the development of the workflow it was really helpful to disable all validators at once by using the <em>setDisableValidators()<\/em> method of the <em>facesContext<\/em>.<\/p>\n<p>To control the behaviour I have added an URL parameter which is checked in the <em>afterRestoreView<\/em> event. If you open the XPage in the format<\/p>\n<pre>http:\/\/hostname\/db.nsf\/xPage.xsp?noValidators=true<\/pre>\n<p>all validators will be disabled. Here is a small example XPage:<\/p>\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;xp:view xmlns:xp=\"http:\/\/www.ibm.com\/xsp\/core\"&gt;\r\n\r\n\u00a0\u00a0 \u00a0&lt;xp:this.afterRestoreView&gt;\r\n\u00a0\u00a0 \u00a0&lt;![CDATA[#{javascript:\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0if( param.containsKey(\"noValidators\") ){\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0facesContext.setDisableValidators(true);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0}else{\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0facesContext.setDisableValidators(false);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0}\r\n\u00a0\u00a0 \u00a0}]]&gt;\r\n\u00a0\u00a0 \u00a0&lt;\/xp:this.afterRestoreView&gt;\r\n\u00a0\u00a0 \u00a0&lt;xp:inputText id=\"inputText1\" required=\"true\" \/&gt;\r\n\u00a0\u00a0 \u00a0&lt;xp:br \/&gt;\r\n\u00a0\u00a0 \u00a0&lt;xp:button value=\"Send\" id=\"buttonSend\"&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;xp:eventHandler event=\"onclick\" submit=\"true\" \r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 refreshMode=\"complete\" immediate=\"false\" save=\"true\" \/&gt;\r\n\u00a0\u00a0 \u00a0&lt;\/xp:button&gt;\r\n\u00a0\u00a0 \u00a0&lt;xp:br \/&gt;\r\n\u00a0\u00a0 \u00a0&lt;xp:messages id=\"messages1\" \/&gt;\r\n\r\n&lt;\/xp:view&gt;<\/code><\/pre>\n<p>This makes developers life easier!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a larger project there are a lot of forms to fill in, each form has many fields with validators and converters. During the development of the workflow it was really helpful to disable all validators at once by using &hellip; <a href=\"https:\/\/hasselba.ch\/blog\/?p=1106\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,22,9,76,74],"tags":[33,7,84,4,5,32,3],"class_list":["post-1106","post","type-post","status-publish","format-standard","hentry","category-allgemein","category-errorhandling","category-javascript","category-ssjs","category-xpages","tag-8-5-3","tag-domino","tag-errorhandling","tag-js","tag-ssjs","tag-tipp","tag-xpages"],"_links":{"self":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1106"}],"version-history":[{"count":5,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1106\/revisions"}],"predecessor-version":[{"id":1110,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1106\/revisions\/1110"}],"wp:attachment":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}