Textfield

The TextField is the most common form element. It consists of a label and a basic box to take character input from the user.

It has many of the basic elements already discussed, including field level validation, the ability to limit the display size on the form and the length of input by the user. The label can be styled and placed to the left or on top of the box, the field can be made required to force the user to input a value, and it can be made read-only to simply display a value and not accept any input.

Textfield’s support database lookups allowing them to be populated by a data source. The can be scripted to perform other functions as well as assigned values and do mathematical calculations. The Textfield Script works the same way but with additional JavaScript support and functionality.

ch7_p41

TEXTFIELD FORMULAE

You can use a formula in a textfield, to perform an arithmetic operation, with these rules:

  1. Formulae must begin with an equal sign (=)
  2. Formulae must contain ONLY numeric values
  3. Formulae expressions are case sensitive
  4. Formulae must comply with the following tables

eXforma Basic Textfield Formulae

Operator Operation Examples
+ Adds two values 2+3 or ID2+100 or ID5+ID17 or RP1+RN2, where RèRelative, PèPrevious, NèNext, and the number is contiguous
- Subtracts one value from another 7-5 or ID5-20 or ID34-ID26 or RP1-RN2, where RèRelative, PèPrevious, NèNext, and the number is contiguous
* Multiplies two values 3*4 or ID12*2 or ID2*ID4 or RP1*RN2, where RèRelative, PèPrevious, NèNext, and the number is contiguous
/ Divides one value by the other 36/6 or ID14/7 or ID23/ID1 or RP1/RN2, where RèRelative, PèPrevious, NèNext, and the number is contiguous

eXforma Textfield Date Formulae

Operator Operation Example
new Date() Prints today’s date in basic format Fri Dec 6 12:39:50 EST 2002
(new Date()).getDate() Prints today’s day 12
(((new Date()).getDate()) + (new Date()).getDate() + ‘/’ + ((( (new Date()).getMonth()+1) ) +((new Date()).getMonth()+1) + ‘/’ + (new Date()).getFullYear() Prints formatted date with leading zeros dd/mm/yyyy 12/02/2002
(new Date()).toLocaleString() Prints today’s date in 24-hour format December 6, 2002 12:39:50 PM
(new Date()).toGMTString() Prints today’s date in basic GMT format Fri, 6 Dec 2002 17:39:50 UTC

The following operators REQUIRE the value to be inside parentheses (). Values can be numbers or cell IDs. The cell ID number MUST be preceded with the ID reference.

eXforma Textfield Math Formulae

Operator Operation Example
Math.sqrt(value) Takes a square root of the value Math.sqrt(144)=12 or Math.sqrt(ID134)
Math.pow( base, power) Takes the base to the power Math.pow(12,2)=144 orMath.pow (ID3,4) or Math.pow(ID4,ID5)
Math.round(value) Rounds the value to the nearest integer Math.round(23.4)=23 or Math.round(ID345)
Math.floor(value) Rounds down to nearest integer Math.floor(12.3)=12 or Math.floor(ID59)
Math.ceil(value) Rounds up to nearest integer Math.ceil(12.3)=13 or Math.ceil(ID37)
Math.abs(value) Takes an absolute value of the value Math.abs(-25.23(=25.23 or Math.abs(ID234)
Math.max(value1value2) Returns the greater of two numbers Math.max(10, 22)=22 or Math.max(ID5, 10) or Math.max(ID135, ID534)
Math.min(value1value2) Returns the lesser of two value Math.min(10, 22)=10 or Math.min(ID76, 3) or Math.min(ID43, ID25)
Math.exp(value) Returns evalue, where value is the argument and e is Euler’s constant Math.exp(1)=2.71828 or Math.exp(ID35)
Math.log(value) Returns the natural logarithm (base e) of a value Math.log(100)=2 or Math.log(ID35)
Math.sin(value) Returns the sine of the number Math.sin(90)=sin(90)=1 or Math.sin(ID23)
Math.cos(value) Returns the cosine of number Math.cos(360)=cos360=1 or Math.cos(ID56)
Math.tan(value) Returns the tangent of the number Math.tan(180)=tan(180)=0 or Math.tan(ID22)
Math.asin(value) Returns the arc sine (in radians) of a value Math.asin(1)=90 or Math.asin(ID46)
Math.acos(value) Returns the arc cosine (in radians) of a value Math.acos(1)=360 or Math.acos(ID22)
Math.atan(value) Returns the arc tangent (in radians) of a value Math.atan(1)=45 or Math.atan(ID24)
Contact Form Powered By : XYZScripts.com