<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Processing form data from HTML POST in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230444#M183574</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been getting on well with creating a first surf application - but have a query regarding the best architecture to adopt in processing user data posted to a url from a browser form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've already created a 'login' component that can appear on any page - it uses an html form to accept username / password, and posts to the '/login' url. A hidden field passes the current page as the success or failure urls - so the user ends up back at the same page whatever happens. The component checks for currently logged in user, and will display the username and a 'log out' link rather than the form if logged in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far the logout link is not ideal - it doesn't return the user to the same page as the Logout servlet doesn't allow us to pass a success url like login.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I want to create a 'register' component. I've successfully created an html form - but now need to write my own webscript to process the user input. My first attempt was to create a 'register' page and post the form data there. However none of my other component webscripts are set up for POSTs - only GETs, so they all throw errors. My register component should be completely independent of the page it's on, or other components, so it's not acceptable to create POST versions of all pages and components.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So now I've set up a webscript - processRegister. The idea is that rather than posting the form to a page url, we post to the webscript which will handle all the registration logic, then redirect back to whatever page the register component form was displayed on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The login servlet uses response.sendRedirect - but I don't think this will be available.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't easily see how share processes posted data - it's all wrapped up in the gui.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So my questions are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Is it a sensible architecture to create a webscript to handle posted form data for each component that uses an html form on the site, and then have it redirect back to the page we came from?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. What api can I use from a webscript to redirect to a page (like the login servlet does)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Aug 2009 09:17:12 GMT</pubDate>
    <dc:creator>jcobb</dc:creator>
    <dc:date>2009-08-14T09:17:12Z</dc:date>
    <item>
      <title>Processing form data from HTML POST</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230444#M183574</link>
      <description>HiI've been getting on well with creating a first surf application - but have a query regarding the best architecture to adopt in processing user data posted to a url from a browser form.I've already created a 'login' component that can appear on any page - it uses an html form to accept username /</description>
      <pubDate>Fri, 14 Aug 2009 09:17:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230444#M183574</guid>
      <dc:creator>jcobb</dc:creator>
      <dc:date>2009-08-14T09:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Processing form data from HTML POST</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230445#M183575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Using a separate web script for handling POSTs and redirecting is what I'm doing too. Haven't found any other satisfactory way of handling user input, and I'm very happy with the principle anyway.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. In order to perform redirects, you should just write this in your javascript:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;status.code=302;&lt;BR /&gt;status.location="your redirection URL";&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sylvain.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Aug 2009 14:06:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230445#M183575</guid>
      <dc:creator>schambon</dc:creator>
      <dc:date>2009-08-14T14:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Processing form data from HTML POST</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230446#M183576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Sylvain - &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll try that redirect code when I get a chance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Incidentally - I'm working on the principal that I'll keep my components completely independent, and unaware of what else is happening on the page. So they'll want to somehow persist some data across page loads without using posts or variables in the url.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see something about persisting data in the javascript api - &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;save()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;reload()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;remove()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am i reading that right that you can keep a component's state the same across page reloads by storing model data and reloading it each time the component is called?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Aug 2009 18:48:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230446#M183576</guid>
      <dc:creator>jcobb</dc:creator>
      <dc:date>2009-08-14T18:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Processing form data from HTML POST</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230447#M183577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK - redirection working well now. In my form I use a hidden field:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;input type="hidden" id="returnUrl" name="returnUrl" value="${page.url.url}"/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and pick that up in the script I'm posting the form to with something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;status.code=302;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;status.location=page.url.args["returnUrl"];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;status.location=page.url.args["reuturnUrl"]+"&amp;amp;registerError="+json.message;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still getting my head round the best way of passing arguments from page to page for a component, will start a new thread…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 18:56:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processing-form-data-from-html-post/m-p/230447#M183577</guid>
      <dc:creator>jcobb</dc:creator>
      <dc:date>2009-08-15T18:56:08Z</dc:date>
    </item>
  </channel>
</rss>

