This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Oct 13, 2011, 4:25 PM
11 Posts
topic has been resolvedResolved

How can I switch off Dojo Validation of a hidden field, please?

  • Category: Extension Library
  • Platform: Not Applicable
  • Release: 8.5.3
  • Role: Developer
  • Tags: Dojo,validation
  • Replies: 3
I love the "Dojo Validation Text Box" of the Extension Library, but I'm struggling to switch off (or on)  the "required" Attribute for a field that is inside a Panel that is hidden or visible depending on a Checkbox being selected.
 
Scenario:-
 
When a Checkbox is selected, a partial refresh displays a Panel that contains a field.
Because it is visible, this field is now mandatory.
But deselecting the Checkbox fails to hide the Panel because the field fails validation if nothing has been entered.
How can I switch the "required" Attribute of the filed to false before the Partial Refresh hides the Panel, please?
 
Thanks for your thoughts. Jerry.
Oct 14, 2011, 1:49 AM
25 Posts
Re: How can I switch off Dojo Validation of a hidden field, please?
 JP,
 
Just set a dojo attribute: 
 
name: "required" 
value: false 
 
Also, take a look here:  http://dojotoolkit.org/api/
 
That site details all of the dojo dijits/widgets, their properties and methods of which can be overridden with a dojo attribute on whatever component. 
 
 
 
Oct 14, 2011, 9:22 AM
11 Posts
Re: How can I switch off Dojo Validation of a hidden field, please?
Thanks Keith for that useful reference.
 
Yes, sorry I knew about the "required" parameter being true or false, it's just that I can't figure out how to programmatically switch it to false when dechecking the checkbox. I can't find the right Event to fire off the (I presume) CSJS.
 
Jerry.
Oct 14, 2011, 9:48 AM
11 Posts
Re: How can I switch off Dojo Validation of a hidden field, please?
Aha! Enlightenment dawns ...
 
Put the following code in the onchange Client Script
dijit.byId('#{id:ReqGiftName}').attr('required', false)
 
where ReqGiftName is the field name contained within the Panel that  is partially refreshed by the onchange Event.
 
Technically of course the dijit code is executed when you first check the Checkbox, but being as the field doesn't exist within the UI it fails (seemingly silently).
 
Thanks again Keith for the reference. Jerry.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal