[Haskell-cafe] WASH defaults in inputFields
Tomasz Zielonka
tomasz.zielonka at gmail.com
Tue Feb 22 12:26:29 EST 2005
On Tue, Feb 22, 2005 at 04:48:07PM +0000, John Goerzen wrote:
> Hi,
>
> Hope this is not a stupid question, but I RTFM'd and couldn't find the
> answer.
>
> 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?
Most functions for creating fields (like textInputField) take a
parameter with type (WithHTML sth CGI ()). Using this you can
supply additional attributes to the INPUT tag, or whatever tag
it is. Now you can simply use ordinary HTML to fill the default
value. For example, if you use textInputField do this:
i <- textInputField (uaVALUE "default value" >> uaSIZE "10")
or this way if you use CGI, not GuaranteedCGI:
i <- textInputField (attr "value" "default value" >> attr "size" "10")
Best regards
Tomasz
More information about the Haskell-Cafe
mailing list