hi, On 7/28/08, Rory Douglas <[EMAIL PROTECTED]> wrote: > I have registered a couple of custom nodetypes with corresponding rendering > scripts html.jsp in the appropriate folder. Now I'd like to include a few > simple forms to create that node type (re-using as much existing > functionality as possible). What is the best way to do this? > > I had a few ideas: (assume I have a nodetype test:Widget with a display > script /apps/test/Widget/html.jsp) > > 1) Create "form" nodes (/forms/Widget/create) > a) use sling:resourceType="form:Widget" > b) register a script /apps/form/Widget/html.jsp that generates an HTML > form (and uses the SlingPostServlet to create the content) > > 2) Create an "empty" Widget node (/content/Widget/new) > a) use jcr:primaryResourceType="test:Widget" > b) register a script with a "create" selector > apps/test/Widget/create.html.jsp that generates the HTML > form
you can simply use a form that posts to the node you want to create, eg: <form action="/content/newnode" method="POST"> <input type="hidden" name="jcr:primaryType" value="test:Widget"/> <input type="text" name="title" value="" /> <form> > I assume I could also register new servlets by paths, and then either > directly create content or somehow forward to the SlingPostServlet. In all > cases where I use the SlingPostServlet, what's the best way to handle > failures or errors? you can either post to a hidden frame, and the read the response via the DOM or use an AJAX post and read the response. regards, toby
