[Seaside] RESTFUL form processing

Tony Giaccone tgiaccone at gmail.com
Tue Jul 12 12:59:03 UTC 2011


I'm trying to understand how to do form submissions to a restful web service
in seaside.

I've loaded up the restful support from seaside30addons

added these packages to the standard downloaded seaside image:

Seaside-Pharo-REST-Core-pmm.4.mcz
Seaside-REST-Core-pmm.23.mcz
Seaside-Tests-REST-Core-dkh.13.mcz

I rand the test cases and they all run fine.


My Html form looks like this:

<html>
<head>
</head>
<body>

<FORM action="http://localhost:8080/rest-example/addUser" method="post">
    <P>
    <LABEL for="firstname">First name: </LABEL>
              <INPUT type="text" id="firstname"><BR>
    <LABEL for="lastname">Last name: </LABEL>
              <INPUT type="text" id="lastname"><BR>
    <LABEL for="email">email: </LABEL>
              <INPUT type="text" id="email"><BR>
    <INPUT type="radio" name="sex" value="Male"> Male<BR>
    <INPUT type="radio" name="sex" value="Female"> Female<BR>
    <INPUT type="submit" value="Send"> <INPUT type="reset">
    </P>
 </FORM>

</body>


I enter data for each field in the form, set the radio box to "Male" and do
the submit.

I have a break point set in my method

addUser
 |aRequest postFields  |
<POST>
<Path: '/addUser'>
 <Consumes: 'application/x-www-form-urlencoded'>
aRequest := self requestContext request.
 postFields := aRequest postFields.
 self halt.
 Transcript show: 'Got it'; cr.

When inspected, postFields has exactly one element which is:

a WARequestFields('sex'->'Male')

Inspect the body and I get:

'sex=Male'

what happened to my form elements???


Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110712/a8957ccc/attachment.htm


More information about the seaside mailing list