Simple script to hide a field on a Form. Need help.

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jaymer
Posts: 1828
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Simple script to hide a field on a Form. Need help.

Post by Jaymer »

in the past, Support wrote this:
--> JaymerTip
A field can be hidden by a simple script attached to a field:
markup.css ("display", "none");

My question is, what do I need to do to make this conditional? The exact syntax is throwing me, cause it may/may not involve JQuery or { } or << >>, etc. and I need to refer to a field value.

Logically, I want to do this, except in Javascript:
IF Customer.State = 'FL' THEN markup.css ("display", "none");

I know how to do the JS, but not how to get the value of an Aware field.

PS__
I tried this:

Code: Select all

if(data["State"] == "FL") {
markup.css ("display", "none"); 
}
but it complains about the word data. I grabbed this from the examples thread for custom HTML templates on the off chance I could figure it out.
Last edited by Jaymer on Wed Feb 12, 2020 4:55 pm, edited 1 time in total.
Click Here to see a collection of my tips & hacks on this forum? Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
aware_support
Posts: 7201
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: Simple script to hide a field on a Form. Need help.

Post by aware_support »

You cannot do this in the script of an attribute, you have to do it in the render script of the corresponding form.
Should be something like this:

var value = parser.getField ("AttributeName1").getValue ();
if (value == "Some Value)
parser.getField ("AttributeToHide").setVisible (false);
Aware IM Support Team
Jaymer
Posts: 1828
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Simple script to hide a field on a Form. Need help.

Post by Jaymer »

thank you very much - but I have 1 more question.

The exact script for the above Q is this:

Code: Select all

var value = parser.getField ("State").getValue ();
if (value == "FL")
parser.getField ("TaxRate").setVisible (false);
What if I want to access LoggedInRegularUser.AccessLevel ?

I noticed while trying to get my script to work that I could NOT reference the field by the standard "BO.Name" format. It only wants the attribute name and will throw an error if I used "Customer.State". So that makes sense since its getting a "Field" in the parser. The field is just "State"
So is there another type of function to get access to SystemSettings and LIRU data?
Click Here to see a collection of my tips & hacks on this forum? Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
aware_support
Posts: 7201
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: Simple script to hide a field on a Form. Need help.

Post by aware_support »

This is available through the Actions framework:

var a = new AwareApp_SystemValueAction (
"AttributeNameInSSORLIRU",
null,
// callback function when the value is received
function (value) {
// do something with the value, for example use in parser
},
this,
isSystemSettingsFlagTrueOrfalse);
a.run ();

Check out the code of this Action in the Aware IM code
Aware IM Support Team
Post Reply