[Haskell-cafe] WASH defaults in inputFields

Matthias Neubauer neubauer at informatik.uni-freiburg.de
Tue Feb 22 12:04:34 EST 2005


John Goerzen <jgoerzen at complete.org> writes:

> I am designing a form that will be used to edit some data that is in the
> database.  I want users to pull up the form and have all the input
> fields pre-filled with the current state of the database (so they don't
> have to re-key all that), then the database gets updated with they hit
> submit.  Simple to do in HTML, but I can't figure out how to do this
> with Wash.  The inputFields don't seem to take a parameter giving a
> default, nor does there appear to be any way to set it later.

> Ideas?

The first argument of input fields is used to attach additional
subnodes to current xml node. I.e., if you pass additional attribute
nodes as first argument, you'll be able to further specify the input
field. There are predefined combinatores (like fieldSIZE or
fieldVALUE) that help to construct common attribute nodes.

Here is a code snippet that should clarify how to do it ...

  ...
  <% iName <- inputField (fieldSIZE 40 ## fieldMAXLENGTH 40 ## fieldVALUE name ## attr "class" "name") %>
  ...

-Matthias

-- 
Matthias Neubauer                                       |
Universität Freiburg, Institut für Informatik           | tel +49 761 203 8060
Georges-Köhler-Allee 79, 79110 Freiburg i. Br., Germany | fax +49 761 203 8052


More information about the Haskell-Cafe mailing list