{"id":1713,"date":"2010-11-09T18:54:00","date_gmt":"2010-11-09T18:54:00","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=1713"},"modified":"2012-01-27T18:55:05","modified_gmt":"2012-01-27T18:55:05","slug":"fetching-the-old-value-in-a-jsf-input-validator","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=1713","title":{"rendered":"Fetching the old value in a JSF input validator"},"content":{"rendered":"<p>In my case, I did this when checking string uniqueness in a table &#8211; if the value entered was unchanged, this would give a duplicate. Whilst I could in theory detect when I was comparing with the old value, this was hard in practice as I did not know which row I was on. <\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/2413424\/how-to-get-old-value-from-jsf-adf-validator\"><strong>This trick<\/strong><\/a> is a good way of not bothering with validation if the field is unchanged. Note the need to cast the UIComponent passed in the event to a UIInput in order to expose the getValue method. Sample code is as follows :-<\/p>\n<blockquote>\n<p>String oldValue = ((UIInput)component).getValue().toString().trim();<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>In my case, I did this when checking string uniqueness in a table &#8211; if the value entered was unchanged, this would give a duplicate. Whilst I could in theory detect when I was comparing with the old value, this was hard in practice as I did not know which row I was on. This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22],"tags":[40,184,16],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1713"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1713"}],"version-history":[{"count":1,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1713\/revisions"}],"predecessor-version":[{"id":1714,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1713\/revisions\/1714"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}