Validation of two \single line textbox\" controls with numbers."


Badge +4

Unfortunately, I cannot create a validation rule which triggers when the condition is true.

I would like to compare two "single line textbox" controls with numbers with the "greaterThanOrEqual"-function. I have created a rule which never triggers.

196816_pastedImage_1.png

What I want is that the validation rule triggers if the "to" value is less than the "from" value.

196850_pastedImage_2.png

I tried to compare the controls in many way, amongst others with the greater than operator. Control is invalid if "from" > "to".

However nothing works. Does anybody can give me a hint or have the solution. I would greatly appreciate it.

Kind regards

Andy


15 replies

Userlevel 5
Badge +14

have you set both control's datatype to integer?

Badge +4

Hi Marian,

thank you very much for your question. How can I set the control's datatype? With the connected list column? I cannot find a setting in the control with which I can set the datatype to Integer. Apparently in Nintex for Office 365 there is a way (http://help.nintex.com/en-US/O365/O365Forms/Form%20Controls/Single%20Line%20Textbox%20Control.htm) but cannot find such a setting possibility in Nintex for SharePoint 2013.

196887_pastedImage_2.png

196886_pastedImage_1.png

Userlevel 5
Badge +14

ok, in that case datatype is taken over from list field (if you haven;t connected it to list filed, you would be allowed to configure it manually).

salary_from list field is of Number datatype as well?

can you clarify whether Basic_actual_salary_from reference in your rule is named control or list field?

as well, do you test in NEW or EDIT form?

Badge +4

Ok. That means the daty type is numer because it is taken over from list field. Yes if I do not connect it to list field I could configure it to Integer.

Yes salary_from list field is of Number datatype as well.

Basic_actual_salary_from reference in my rule is a named control. I tested it in NEW and in EDIT form. Nowhere it works. However the column name and the control name have the same name. Maybe this causes problems. I will test it and give feedback.

In NEW form I cannot compare with a field. Therefore I tried to compare controls which are connected with list columns. But this seems not to work with the rules. :-(

I just see that there is a column validation in the column list field. Is this an alternative.? I will try and give feedback (see below).

Thank you for your help. Your  input makes me to reconsider the things... I greatly appreciate it.... :-)

196890_pastedImage_2.png

Badge +4

Unfortunately nothing helps.

In the list field column validation I cannot refer to another column ("The formula cannot refer to another column....") and the Nintex rule never triggers. I would be happy if somebody could help me here....

196895_pastedImage_1.png

196896_pastedImage_2.png

Userlevel 5
Badge +14

just to be sure before we dig into it deeper: validation doesn't fire when you submit form?

or do you expect it to happen when you change values?

Badge +4

Yes validation does not fire when the form is submitted.

When I want to edit the form (change the values) and then submit the form. Validation does not fire either.

In short, the same problem for the NEW and EDIT form.

Userlevel 5
Badge +14

ok.

have you resolved this?

However the column name and the control name have the same name. Maybe this causes problems. I will test it and give feedback.

let's try following

- add 4 calculated value controls on form and set up their formulas as follows (make sure you use named controls!)

- basic_salary_from

- basic_salary_to

- basic_salary_from+basic_salary_to

- greaterThenOrEqual(basic_salary_to,basic_salary_from)

type in some values into basic_salary_from and basic_salary_to controls and watch how calculations evaluate.

post results.

Badge +4

Yes I have resolved that but this is not the cause (unfortunately):

196926_pastedImage_1.png

Like you suggested:

4 calculated values were added. All the calculations behave like they should. This works. Therefore it seems to be weird that the validation rule is not triggered althout the condition is false.....

196932_pastedImage_4.png

196931_pastedImage_3.png

 

But the validation rules again fail, both in the rule which compares the controls 

- basic_salary_from

- basic_salary_to

  and the calculated control rule "greaterThanOrEqual(basic_salary_to,basic_salary_from)". In the calculated control rule the value is false!

{Self} is here the the calculated value control at the end "greaterThenOrEqual(basic_salary_to,basic_salary_from)"

196936_pastedImage_8.png

Thank you very much for your help, Marian.

Userlevel 5
Badge +14
validation rule is not triggered althout the condition is false.....

be careful, validation rule make a control invalid if it evaluates to TRUE!

and the calculated control rule "greaterThanOrEqual(basic_salary_to,basic_salary_from)". In the calculated control rule the value is false!

why do you think this is incorrect?

salary_from == 5

salary_to == 3

so, salary_to >= salary_from  is correctly evaluated to FALSE

{Self} is here the the calculated value control at the end "greaterThenOrEqual(basic_salary_to,basic_salary_from)"

here you have to be carefull as well!

{Self} represents value of calculated value control. since that control doesn't natively support boolean values 'false' in that case is in fact text string.

so, you would need a condition like this to check result of calculated control value is (boolean) false

{Self} == "false"
Badge +4

Hi Marian

Thank you for your help. :-)

Now we are one step further. Validation works for a short time. The control is shortly red framed but then a browser refresh happens. Then all the other validations appear (e. g. a field must have a value *) and this control is not more red framed.

After pushing the send button, there is no efficient validation for this control any more. Also no message appears ("Take care...") for this control.

196965_pastedImage_1.png

196966_pastedImage_2.png

This valdidation I tried with the rule. But the control is not red framed, not even before the browser refresh. After refresh it also does not to work.

196977_pastedImage_4.png196978_pastedImage_5.png

In the developper tools (F12) or IE11 , in the console section, I can find an error message.

196979_pastedImage_6.png

SEC7132: The certificate protecting this web site uses weak cryptography, SHA1. The web site should replace this certificate with a SHA2 certificate before SHA1 is no longer allowed.

Can this be the reason?

In any case, the written symptom (refresh after validation rule), also appears in the browsers Mozilla and Chrome.

Userlevel 5
Badge +14

I've never seen this error, but it seems to be some security problem so I would say it shouldn't have impact.

have you checked developer console before submit, weren't there any errors?

page reload during validation phase usually signalize some error with javascript/rules/control's custom validation...

try to switch off 'clean at navigation' in developer console so that all the messages retain there if one appears after you press submit and before reload.

if you remove validations for salary, does the form reloads as well?

do you uhave any other rule(s) applied to salary controls?

do you by any chance, apart from rules, use as well custom validation on controls?

Badge +4

Hi Marian,

thank you very much for your help. I greatly appreciate it.

With your help I could find the cause. "do you by any chance, apart from rules, use as well custom validation on controls?"

In the "submit" button there is a validation. The filename of the attachment is validated (Are not allowed characters used?) by JavaScript (custom validation).

After not using more this validation, there is no page reload more during validation phase. Everything works like it should. Thank you very much for finding the reason.

Case solved. The only question is now for me how I can do it together with a custom validation.

Best regards

Andy

197089_pastedImage_1.png

197094_pastedImage_3.png

Userlevel 5
Badge +14

I would say if the attachment validation function worked correctly, the form shouldn't have been reloaded.

try to remove function's body and let it simply just return true/false how will it behave.

Badge +4

Unfortunately, this phenomenon happens also when I write "return true" instead of return JavaScriptFunction() in Client click of the submit button. Always a  reload takes place and the form validation rules are not considered.

197147_pastedImage_1.png

However I could solve the problem:  How to avoid file attachments with "special characters" in file name? (see: : https://community.nintex.com/message/37086).

Instad of calling the function after pressing the submit button ("Client click") I have created a rule where I use the validation of the attachment file names by the JavaScript "ValidateAttachments()" which I overtook from the given reference and slightly adapted.

JavaScript function:

function ValidateAttachments()
{var isValid = false; 
NWF$('.nf-attachmentsTable').find('tbody').find('tr').each(function()

 var file = NWF$(this); 
var fileName = file.find('span')[0].innerText; 
var match = (new RegExp('[~#%&{}+|]|\.\.|^\.|\.$')).test(fileName); 
 if (match)

isValid = true; 
alert('Invalid attachment file name. Please remove the special characters which are not allowed in SharePoint and try again. File name: ' + fileName);

});
return isValid; 
}   

197148_pastedImage_3.png

Everything works like it should now. :-)

Reply