field values

Avatar

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
rickstsx04
Level 1

06-10-2015

Hello,

How do I set a field to be required to be less than or equal to another field?

Accepted Solutions (0)

Answers (6)

Answers (6)

Avatar

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
rickstsx04
Level 1

13-10-2015

Thank you Bruce this helped a lot!

I added the following to the ValidationState event to clear the field if it fails validation:

if (this.errorText) this.rawValue=null

Thanks again,

Ricky

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

08-10-2015

Hi Ricky,

I'm not sure why you have braces around your code, is this just a fragment of your code?  In a validate event it is the last expression that is evaluated as a true or false.  So you should just need (no return required);

var nLine37a = NJ1040.Page3.Table8.Row37a.Line37a.rawValue;

var nLine38 = NJ1040.Page3.Table15.Row38.Line38.rawValue;

  

nLine38 < nLine37a;

Note that you had .rawValue on both the first two lines as well as the condition ... it should be one or the other.  Also do you have two tables, table8 and table15?

Regards

Bruce

Avatar

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
rickstsx04
Level 1

08-10-2015

Hi Bruce,

Still no luck,

I tried putting this code in the validate event:

{

    var nLine37a = NJ1040.Page3.Table8.Row37a.Line37a.rawValue;

    var nLine38 = NJ1040.Page3.Table15.Row38.Line38.rawValue;

   

    if (nLine38.rawValue < nLine37a.rawValue)

    {

    //we're ok

    }

    else

    {

    alert("Line 38 cannot be greater than Line 37a");

    return false;

    }

}

I only need to prevent the user from entering a value that is greater than the value entered in the previous line.

Thanks for your input,

Ricky

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

07-10-2015

Hi Ricky,

I think I am still missing something.  Sounds like you need to add the following JavaScript code the validate event of Line38

this.rawValue <= Line37a.rawValue;

I assume the numeric field Line38 is under Row37a.

Regards

Bruce

Avatar

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
rickstsx04
Level 1

07-10-2015

Hello Bruce,

My apologies, I will provide more information.

I have a numeric field that I named line 37a

The next field, line 38 must be less than or equal to Line 37a.

I tried the following calculation script, but it did not work:

if (this.rawValue > Table8.Row37a.Line37a) {

  this.rawValue = null;

}

Thank you for your help,

Ricky

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

06-10-2015

Hi,

We probably need more information, but if you had a NumericField1 and NumericField2 and a TextField1 that became mandatory when NumericField1 was less than NumericField2 then you could use the following JavaScript code in the calculate event of a subform containing all three fields.

 

if (NumericField1.rawValue < NumericField2.rawValue) {

    TextField1.mandatory = "error";

}

else {

    TextField1.mandatory = "disabled";

}

 

Regards

Bruce