PATH Documentation > WebObjects

Table of Contents

WOTextField



Element Description

A WOTextField represents itself as a text input field. It corresponds to the HTML element <INPUT TYPE="TEXT"...>.


Synopsis

WOTextField { value=aValue; [formatter=formatterObj;] [dateformat=dateFormatString;] [numberformat=numberFormatString;] [name=fieldName;] [disabled=aBoolean;] ... };

Bindings

value
During page generation, value sets the default value displayed in the single-line text field. During request handling, it holds the value the user entered into the field, or the default value if the user left the field untouched.
formatter

An instance of an NSFormatter subclass to be used to format object values for display as strings, and format user-entered strings back into object values. This attribute should specify a variable containing (or method returning) a preconfigured formatter object. For instance, a WOTextField might have the binding:

formatter = application.dateFormatter

With the following code:

// Application.wos
NSFormatter *_dateFormatter;

- (NSFormatter *)dateFormatter {
    if (!_dateFormatter) {
        _dateFormatter = [[NSDateFormatter alloc]               initWithDateFormat:@"%m/%d/%Y"             allowNaturalLanguage:NO];
    }
    return _dateFormatter;
}

If a user enters an "unformattable" value, WOTextField passes the invalid value through, allowing you to send back an error page that shows the invalid value.

dateformat
A format string that specifies how value should be formatted as a date. If a date format is used, value can be assigned an NSCalendarDate object (if it is assigned an NSString object, it will be stored as the string representation of an NSCalendarDate object). If the element's value can't be interpreted according to the format you specify, it is set to nil. See the NSCalendarDate class specification for a description of the date format syntax.
numberformat
A format string that specifies how value should be formatted as a number. If a number format is used, value must be assigned an NSNumber object. If the element's value can't be interpreted according to the format you specify, value is set to nil. See the NSNumberFormatter class specification for a description of the number format syntax.
name
Name that uniquely identifies this element within the form. You may specify a name or let WebObjects automatically assign one at runtime.
disabled
If disabled evaluates to true (or YES), the element appears in the page but is not active. That is, value does not contain the user's input when the page is submitted.

Table of Contents