Child pages
  • How do I manage standard HTML attribute markup?
Skip to end of metadata
Go to start of metadata

If you were editing plain HTML you might wish to mark up a FORM INPUT component with attributes such as size= maxlength= name= value= etc. In WO, these are not managed in the HTML itself as you might expect, but in the associated .WOD file. This was previously managed for developers using Apple's WO tools with the WOBuilder application which presented a visual interface that hid the necessity for understanding these bindings from the developer. Unfortunately, many of the existing tutorials for how to manage this refer to these Apple tools, and since the relationship between the .html and .wod files was not explained, it can remain somewhat mysterious to the new user. Fortunately, the answer is quite simple! Example:

To add the SIZE attribute to a FORM INPUT component

Say you wanted to add the LENGTH attribute to an HTML text input field that held a user's email address, and the default text field size was too short. Assuming the WebObject was named <webobject name = "email" /> in the .html file, you could add the SIZE attribute to it by editing its .wod file mapping as follows:

email : WOTextField {
  value = user.email;
  size = "30";
}

This would generate the following HTML

<input size="30" type="text" value="whatever the generated value is" name="whatever WO refers to this field as">

More information on this general subject can be found at Modern Binding Styles, and for more experienced users on p201 of Practical WebObjects, Apress 2004, Hill & Mallais.

  • No labels