This content has been marked as final. Show 4 replies
Here is the problem:
I have three text fields (Textfield1, Textfield2, Textfield3).
I created three variables (var1, var2, var3) and initialized them to 0.
In order to determine how many of the fields contain data, I used if/then/else statements:
if (Textfield1.rawValue == “”) then
Textfield2 and Textfield3 have similar statements (using variables var2 and var3 respectively).
To test the code, I have a message box returning the sum of var1 + var2 + var3. With NOTHING entered into any of the text fields, I would expect it to return a sum of 0, but it returns a sum of 3! If I enter data into just one or two of the fields, again it returns a value of 3!
I’ve tried initializing the value of the Textfields (Textfield1.rawValue=””), but I still keep getting a value of 3.
It's probably a simple programming error, but again I'm not a developer. Any help would be appreciated.