Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

Storing data using static forms

Avatar

Level 4

I am following this tutorial:

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

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.

1690693_pastedImage_1.png

<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,

1 Accepted Solution

Avatar

Correct answer by
Level 10

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>

View solution in original post

4 Replies

Avatar

Level 10

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.

Avatar

Level 4

Can you provide me an example fragment please.

Avatar

Level 10

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

Avatar

Correct answer by
Level 10

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>