cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
721
Views
0
Helpful
4
Replies

addValidator for Required Fields

James Fuller
Level 1
Level 1

addValidator for Required Fields

We would like to be able to control the assignment of the field validation (required fields) based of a selection by the user on the order form.

I have been able to assign this to a field based off of a selection, however, I would also need to remove it if the selection changes.  This is where I am running into problems.  I can't seem to remove it once it's added.

Has anyone been successful in doing this?  I know I'm missing something here...

4 Replies 4

This should work:

serviceForm.dictionaryName.fieldName.validators = ''

James Fuller
Level 1
Level 1

Here's what I did:

function S1476_Coop_Modify_Question4_onClick () {
  rcDebugLoad("Entering Function S1476_Coop_Modify_Question4_onClick");
  var secOwner = gethtmlinputvalues ('Coop_Modify.Question4');
  if (Moment == 'ordering') {
   switch (secOwner) {
    case 'No':
     document.all['Coop_Modify.Question5.Row'].style.display = 'none';
     docum

Ok, this one is hitting it over the head, but it should work:

Set the options[0].value of the field back to a non-null value, for example, "N/A", "not applicable", or the original "Please select" value, so the validator wouldn't apply.

Make the field non-mandatory.

James Fuller
Level 1
Level 1

Hi Leslie,

You're right, that would work.  I certainly appreciate your feedback on this discussion.

I may try to write something that mimics the addValidator method, but add a switch that would turn it on and off.  We'll see if I have time to do that in the coming weeks.

Thanks!