Expand my Community achievements bar.

Hierarchy Scripts

Avatar

Former Community Member
I have placed a script into the Hierarchy of my form and can call it. My problem is that I need to make sure that the TextField that the sricpt is associated with is either populated or not. I have tried Formcalc methods and Javascript I cna't figure out how to make sure that the textfield is populated or not, and then how to call the function. Variable name is EmpName, the Function name is Invest().

I am trying to do this in docReady event.



In JS I have this code

if (InvName = null)

EmpName;

else

InvName.access = "readOnly";

This doesn't work, but this does

if (Invname = null)

Invname.access = "readOnly";

else

EmpName;



FormCalc I have tried this:

If (HasValue(form1.#subfrom1.InvName)) then

InvName.access = "readOnly";

else

form1.#subform.variables.EmpName.Invest();



Can Someone please help me figure out how to make sure that the textfield is populated or not, and how to call the variable with its associated function.
5 Replies

Avatar

Level 5
Try this in JavaScript:

if ((InvName.rawValue == "") || (InvName.rawValue == null)) {

Empname.Invest();

} else {

InvName.access = "readOnly"

} // END IF



You did not state if you are trying to pass the contents of InvName into the Invest function.



Good Luck

Mark

Avatar

Former Community Member
I have tried your code and it works, however it brings up the function Invest twice, as if it repeats itself.



This is what I am doing. I have a Investigation form that upon a new investigation, three functions are called in the docReady. One asks for thier employee number, another asks them for the dept #, and finaly they are asked for their Name. I wanted to make the form available once all the data was saved, and didn't want the user to have to fill in the required data again. (I am still new at this). The three functions just ask for information and then it is passed to the appropriate textField, however if the information is missing or left out the funcation asks for it again.



Thanks for the help.

Avatar

Level 5
OK - I think what might be going on may have something to do with what properties are being set when.

When you set Employee Number, Dept #, and Name - where are you storing the results? In .value, .rawValue, etc.

Depending on what property is being set, the code I gave you might not detect a value.

If you supply a little more info, I might be able to give you a better answer

Avatar

Former Community Member
I understand, I am sorry for the confusion. I was able to get it to work without call the function Invest(). I can send you the file and let you look at it if that will help.

Thanks

Avatar

Level 5
You can send it to mark.lindberg@tech-pro.com, I'll take a look at it.