Storing data using static forms | Community
Skip to main content
arjuns71585267
Level 4
February 13, 2019
Solved

Storing data using static forms

  • February 13, 2019
  • 4 replies
  • 2082 views

I am following this tutorial:

Adobe Experience Manager Help | Persisting Adobe Experience Manager 6.4 JCR data using a Custom Form Action

Is there any way to get the data using normal input boxes from a page designed on static template and submit it into the jsp file POST.post.jsp. Here is the design and code of my page designed using static templates.

<H1>Enter employee details</h1>

<form action="/apps/eysample/components/structure/contentpage/processform.jsp">

  First name:<br>

  <input type="text" name="firstname">

  <br>

  Position:<br>

  <input type="text" name="position"><br>

  Office:<br>

  <input type="text" name="office">

  <br>

  Age:<br>

  <input type="text" name="age">

  <br>

  Date:<br>

  <input type="text" name="date">

  <br>

  Salary:<br>

  <input type="text" name="sal">

  <button type="submit">Submit</button>

</form>

I tried creating a copy of post.POST.jsp and referred it as shown in the code. Can anyone please help me out because my method is not working,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gaurav-Behl

use POST.jsp with this -

<form action="${resource.path}" enctype="multipart/form-data" name="subscribeForm" id="subscribeForm" method="POST"  onsubmit="return validate(this, rules);">

// form fields

</form>

Alternatively:

<script>

$(document).ready(function() {

$( "form" ).submit(function( event ) {

// do something

}

});

</script>

4 replies

Gaurav-Behl
Level 10
February 13, 2019

Use <form method="POST" action="<somepattern>.post.<someextension> >......... </form> in your jsp/htl script and when you post your form it will submit to POST.jsp.

Alternatively, you could use jquery/js to submit the form.

arjuns71585267
Level 4
February 13, 2019

Can you provide me an example fragment please.

smacdonald2008
Level 10
February 13, 2019

For HTML Form elements - as opposed to AEM Form components -- see this as an example. Its an older article - but you will get the point.

Scott's Digital Community: Submitting Adobe Experience Manager form data to custom Sling Servlets

Gaurav-Behl
Gaurav-BehlAccepted solution
Level 10
February 13, 2019

use POST.jsp with this -

<form action="${resource.path}" enctype="multipart/form-data" name="subscribeForm" id="subscribeForm" method="POST"  onsubmit="return validate(this, rules);">

// form fields

</form>

Alternatively:

<script>

$(document).ready(function() {

$( "form" ).submit(function( event ) {

// do something

}

});

</script>