-
Sep 18th, 2010, 07:33 PM
#1
Processing forms in webscript which is part of page
Hi all,
I created a RESTful service (webscript) with a form on it. It processes GET (responds with a form) and POST (shows the result) at the moment. It works fine till I add that webscript to a page that contains other webscript components like header and footer. Once I submit the form I get exceptions that neither header nor footer supports the method POST.
Please could someone advise what is the proper way to process forms? I don't want to include the whole page into the webscript respond because it goes against the main idea of surf (as I understand it) – arranging multiple components on one page.
Thanks!
-
Sep 20th, 2010, 03:32 AM
#2
You have two options, in the trunk we have added a feature so that all components fall back to the .get implementation if no .post implementation is found -this is ideal for POSTing to pages where you only want to add specific .post logic for some components - so update to trunk codeline will fix it for you. The other option is to add .post implementations for all the components on the page you are POSTing too - this is obviously annoying as it is a copy/paste exercise - but if you don't want to update to trunk that is your option currently.
Cheers,
Kev
-
Sep 20th, 2010, 06:51 AM
#3
If you do take the duplicate post file route then you can import the get js and freemarker files into the post files to avoid duplicating the file contents.
-
Sep 20th, 2010, 07:16 AM
#4
Thanks a lot for the quick response.
The behavior to fall back to the .get implementation for all the components that doesn't have .post is exactly what I would expect. Thanks for adding that feature!
-
Sep 23rd, 2010, 08:26 PM
#5
Tested. Everything works fine except... post parameters aren't reachable as
args["paramName"]
-
Sep 24th, 2010, 04:27 AM
#6
I assume you are talking about the .post implementation webscript? As you wouldn't expect POST params from a FORM to be available to .get webscript impls. Also if you are submitting a FORM then the data should be available in the "formdata" model object.
Cheers,
Kev
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules