WASH defaults in inputFields

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? Thanks, John

John Goerzen
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

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

On Tue, Feb 22, 2005 at 06:26:29PM +0100, Tomasz Zielonka wrote:
i <- textInputField (uaVALUE "default value" >> uaSIZE "10")
or this way if you use CGI, not GuaranteedCGI:
Speaking of which, I couldn't find any documentation on GuaranteedCGI at all. What's the difference between it and CGI? Thanks! -- John

At Tue, 22 Feb 2005 18:26:29 +0100, Tomasz Zielonka wrote:
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.
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")
For what john asked, I usually do something like: i <- textInputField (fieldVALUE "the default value") Not sure if there is any advantage/disadvantage to that. Jeremy Shaw. -- This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender and delete the message. Thank you.
participants (4)
-
Jeremy Shaw
-
John Goerzen
-
Matthias Neubauer
-
Tomasz Zielonka