textarea and jsp - forms

I have a textarea that I first print some values coming from a request.getParameter("some_textarea_name"). The user is allowed to modify those values and then I want to get the new values and replace the old ones with the new ones so as to query the new ones and get the results from my database tables. Can I do that without redirecting the user to a new page e.g without using the <form method> and the request.getParameter()

Can I do that without redirecting the user
Yes, you can implement an ajax call that will submit the form without redirecting the user and you can do something with the response (perhaps add it to the page).
If you need help using ajax follow this tutorial, but be aware that it implements AJAX in pure javascript (its a bit more bloated / complicated). If you want to keep it simple look into jQuery ajax, and here is a tutorial too.
without using the
No, you need to use the form to be submitted, however if you use ajax you wont need to redirect the user.

Related

amp project form submit

I'm currently testing a landing page made with amp.
There's a lot of information on how to make forms but,
nothing on how the form is process.
Where we insert the recipient email?
Do we need to make a submiter.php?
Thank you!
Yes, you need to create a server endpoint to handle the form submission. If you use method="POST" then you should also add action-xhr="submitter.php" and then submitter.php should collect the values in the form, and return JSON to the AMP page.
If you use method="GET" then you can use action="submitter.php" or action-xhr="submitter.php. If you use action and not action-xhr then submitter.php doesn't need to return JSON, it can just be a normal PHP/AMP page that takes the values of the form and sends an email or whatever you want

Joomla Contact Form (from the ground up)

I'm looking to create a customized contact form in a Joomla 3 site I have created. I know how to write the php code for the form, but I'm unsure of where to place the code.
Ok, the form is located at http://www.theoscorner.com/contact-us. What you see there is only the design, and there is currently no script for the form to submit to. If I wanted to create a new php page for the form to submit to, what is the best method of doing this? For example:
Should I create a completely new php file where the template's index.php file sits, and use a module (instead of an article) to hold the form.
Should I create a new article page, and place my php script in that article?
Should I hard-code my form into a module, and place a php function at the end of the index.php page which gets called when the page is refreshed and the POST values are set.
I'm just looking for any type of guidance I can get right now. I don't want to use a third-party plugin, because I want a little more control than they allow. Thank you for your time.
Just use RS Forms or Contact Enhanced, they are both Joomla extensions available on extensions.joomla.org
There is no need to create your own MVC component.

Disable form validation on empty forms with Play Framework

I'm pretty new to Play Framework.
My problem is that when a user clicks on the register link, he will instantly see validation errors.
The problem is that the method that serves the form also validates the form. So when the user clicks on the register link, gets to the validation without any input and then gets validation errors.
One solution would be to have an extra method to only serve the register form. But this would require an extra form and an extra route.
Another solution would be to disable validation on empty forms.
Is this possible? If not is there an other way?
You are on the way to a good solution. Make a second method.
GET /register controllers.RegistrationController.showRegistration()
POST /register controllers.RegistrationController.register()
The first is to display the registration page with the form, the latter to handle the form submit.
A method should stick to do one thing: either to show a registration page or to handle a post. Generally it's not a good idea to write a single method with a lots of if-then-else flow control statements.
Play framework also supports REST principles: in a simplified way GET is to retrieve a resource (=an empty registration page here), POST is to submit data(=do the registration).
Have a good look at Play framework's examples, I think the computer-database is very simple and a good starting point for you.

ASP Classic - Passing form data to Iframe

I'm looking to pass data from a form into an iFrame, but I have a slight problem.
The form page I can edit with no restrictions
The page I send the data to I cannot edit unless its html or JavaScript
The data needs to end up in an iframe within this page, which I can edit with no restrictions
I'm incorporating a search function into a CMS system which is why I cannot edit the iframe's parent page, and why I am using iframes at all.
At the moment the data sends to the parent page but is not picked up within the iframe, I am sending via the POST method.
I got it..
Added and extra page which converted the post data into session data,
if anyone knows a better way i would like to hear it though.
And they are the same domain, but editing the CMS system would have taken ages to look through as its not mainstream or developed by me.
Maybe I'm oversimplifying the problem, but can't you use the "target" attribute of the form tag to post to the Iframe?

Can I get the source of the current Wicket Page?

I've been using wicketTester.getServetResponse.getDocument to get the text of the current page for testing, only to find that after an ajax request it is set to the ajax response, not the whole page.
Is there any way to get a representation of the whole rendered page, as the browser would be seeing it after the ajax manipulation?
With WicketTester, you can simulate an Ajax call and see that your app sends the correct Ajax response. But it doesn't really exercise the ajax.
So I don't believe there's a way to get that from WicketTester.
If you actually need to test the app all the way to the UI including Ajax/javascript effects on the rendering, you likely need to use something like Selenium for that portion of your testing.
Thinking the Wicket way I hope the following approach should work:
#startPage(YourPage.class)
do some Ajax calls
#startPage(wicketTester.getLastRenderedPage())
wicketTester.getLastRenderedPageAsString()
The idea is: you start a page for testing, the first response is complete page response, then you do some Ajax calls which change some models around, then you start the last rendered page as an instance - this way it will render the page with the updated models from the Ajax calls.
The trouble is that you can put any Javascript in the response to an Ajax call. But if you don't want to deal with that, you can save the original full-page DOM, iterate through the objects in the Ajax response, find them by id in the full DOM and replace them with the new versions.
How useful this would be, I don't know, my guess would be not very. so I'd probably go with Selenium too.