cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I can't seem to use a hyperlink field in a validation rule

I am using Nintex 2013 forms.  I have an Invoice Request form that I created that needs some conditional required fields.  One of the fields (Budget Actuals) is only required if the user didn't enter an link to their budget summary (hyperlink field).  When I create the rule

 

isNullOrEmpty({ItemProperty:Budget_x0020_Summary})

 

it is not validating that the Budget Summary field is filled in - it is always showing that it's blank.  The one thing I noticed is that the field was not available for selection in the Named Controls - only in the Item Property list.  Is this the problem?

 

I am not a programmer at all, but have been able to rely on Rules to accomplish conditional required fields.  However, I have never based it off of a hyperlink value.  I even tried adding a calculated field to the form to try and grab the value of the field, but it is always blank.  I also tried using the Length() function in the calculated field, but no matter what is typed in the field, the value is always 0.

 

Would love some ideas on this one?  Deadline for form is next week!

 

Thank you!

Labels: (2)
Tags (1)
0 Kudos
Reply
4 Replies
Workflow Hero

Re: I can't seem to use a hyperlink field in a validation rule

Hi Sara,

Have you entered a name in the Budget Summary control?

If you are just using the {ItemProperty:Budget_x0020_Summary}, this would be drawing from the item - which I assume(?) has not actually been created yet. By putting the Name on the control, you should be able to utise the field on the form in your validation rule.

Cheers,

Mark

0 Kudos
Accept as Solution Reply
Not applicable

Re: I can't seem to use a hyperlink field in a validation rule

I did. That’s what I thought I possibly did wrong, but then I noticed that ANY of the fields that are hyperlink controls are not showing up in the Named Controls selection. Here are my screen shots:

And here you can see it is not listed as an option, but it IS in Item Properties, which as you stated below would not work because the item is created yet.

Thanks!

0 Kudos
Accept as Solution Reply
Not applicable

Re: I can't seem to use a hyperlink field in a validation rule

Hi Sara,

 

So you're having an HyperLink column type called Budget Summary and another column called Budget Actuals in your SharePoint list, and you want the Budget Actuals to be required only if user didn't key in URL in Budget Summary.

 

Seems like the Hyperlink control's name doesn't appears in the rules. To achieve what you trying to do, you can use Custom Validation.

 

Steps:

  1. In form designer, double click your Hyperlink control, in the Advanced section, change the Store Client ID in JavaScript variable to Yes, and in Client ID JavaScirpt variable name, key in BudgetSummary. Save the settings.
  2. Then double click on your BudgetActuals control, in the Validation section, change the Use custom validation to Yes, in the Custom validation function key in ValidateBudgetSummary, and key in your Custom error message, Store Client ID in JavaScript variable to Yes, and in Client ID JavaScirpt variable name, key in BudgetActual. Save the settings.
  3. Click the Settings button in the ribbon to get to form settings.
  4. In the Custom JavaScript section, key in the below code. (Copy and paste the code in Notepad, then copy from Notepad to the Custom JavaScript box, to avoid pasting extra stuff copied from webpage)

 

function ValidateBudgetSummary(args, validator) {     var URL = NWF$('#' + BudgetSummary).val();     var actual = NWF$('#' + BudgetActual).val();     if (URL.length <= 0) {         if (actual.length <= 0) {           validator.IsValid = false;         } else {           validator.IsValid = true;         }     } else {         validator.IsValid = true;     }     } 

 

     5. Publish the form.

 

What this do is whenever you submit the form, it will run this function, it will check if the hyperlink control's URL box has any value, if both BudgetActual and BudgetSummary are empty, then the form is invalid, if either one of them is not empty, then the form is valid.

 

Help it helps

0 Kudos
Accept as Solution Reply
Not applicable

Re: I can't seem to use a hyperlink field in a validation rule

Worked like a charm! Thank you!

0 Kudos
Accept as Solution Reply