Powermail broke on first click to submit - typo3

I have an error with my powermail form.
I copied one form from my site and made some little changes and now the new form doesn’t work right.
When I click on submit the form isn’t send it only “destroys” the frontend and I have to fill the fields new to submit it (then it works).
I have this warning in the console: Parsley’s pubsub module is deprecated; use the ‘on’ and ‘off’ methods on parsley instances or window.Parsley
Do you have any idea?
I’m new in the project and don’t created the first form.
Powermail: 3.22.1
TYPO3: 7.6.30

I would check if there are any redirects while form submitting. If forms are getting submitted and it seems that they are reloaded and empty, it often happens, that the form target is wrong.
E.G. If absRefPrefix is set to http:// and there is an additional .htaccess redirection from http:// to https// or so the POST params get lost and powermail shows the form again.
You can check redirects in your browser console.

Related

Problems when submitting a form in TYPO3 v9.5

In TYPO3 versions before v9, when using the native form, I always disabled the cache of that specific "contact" page (where the form was placed). If I didn't disable the cace, the form wouldn't redirect to my "confirmation" (v6/v7) or "redirect" page (v8), but instead it would simply reload the (filled-out) form (on the same page).
So, to bypass this and to make sure that the form actually got submitted and forwarded to the correct confirmation page, I always disabled the cache (Page Properties -> Page -> Behaviour -> Disable cache).
In TYPO3 v9 however, this option has been removed, and adding config.no_cache = 1 into that specific page (in a TS template), doesn't seem to do the (same) trick.
I would expect that the form, after clicking the submit button, would forward to the confirmation (redirect) page which I configured insde the form itself. That confirmation page isn't usergroup-protected or anything, it's simply a sub-page of the "contact" page (containing the form) itself.
The actual issue in this case is that you are most likely using some kind of autofill for your fields, e.g. from Chrome or using a form filler extension.
This will also fill the honeypot field of your form which then prevents submitting the form.
Right now there is nothing you can do about this except voting for the bug in the Chromium issue tracker.
As Mathias Brodola righfully points out, this seems to be a problem in Chrome only. I found this following plugin - that completely disables autocomplete support for a form - to be helpful in this matter. It solved my issue (however, it does completely disable auto-complete support for the form):
https://github.com/terrylinooo/jquery.disableAutoFill

Symfony form validation on redirected page

Is it possible to display the form error on a redirected page instead of a rendered page?
I have 2 forms on 1 page each submitting to their own actions. If form 1 is not valid it will skip if($form->isValid()) and go straight to render
which will then display the form errors. The 'render` for this actions only displays form 1).
The issue with this is I would like it to redirect back to the original page where I have both of the forms but still display the form errors.
I don't know any easy way to do this, so I give you an idea how this could be done the "hard" way:
Serialize the validated form using JMSSerializerBundle
Set the serialized form as flashbag message
Redirect
Check for the form in the flashbag, unserialize, show the errors of both.

Wicket: Loosing form input on page re-render

I have pages with forms. Everything is working fine. Except, that there is a link (language selecter) on the pages. The requirement is, that when the user has already input in the form fields and than (without submitting the form) is clicking the link, all input should be retained.
If the link would be part of the form, this could easily archived via a SubmitLink and submitLink.setDefaultFormProcessing(false);
Unfortunately, this link has no knowledge of the form(s) on this page.
Any pointers if this is solvable? Of course, validation should not be triggered.
client-side JavaScript solution
wrap complete page content in a form
(yes, Wicket allows nesting of forms) and use an SubmitLink with
defaultFormProcessing=false
add an AjaxFormComponentUpdatingBehavior
to all your form fields, so the input is always sent to the server

Angularjs default action form submit

My angular application needs to submit a form to a vendor. They then redirect the user to a page that I specified earlier in the process.
So I want standard, non-angular html form submit behaviour.
The documentation (details below) makes it sound like all I need to do is add an action attribute to my form element. I have tried this and it does not work.
Has anyone used this functionality in angular? Is there another step that I am missing?
The relevant section of the documentation at https://docs.angularjs.org/api/ng/directive/form is:
Submitting a form and preventing the default action
Since the role of forms in client-side Angular applications is different than in classical roundtrip apps, it is desirable for the browser not to translate the form submission into a full page reload that sends the data to the server. Instead some javascript logic should be triggered to handle the form submission in an application-specific way.
For this reason, Angular prevents the default action (form submission to the server) unless the element has an action attribute specified.
Angular does that. When you provide an action on the form, it should do exactly what you're trying to do (do a javascript thing, then submit the form).
Here is a plunk
In the plunk, you can see the $scope.submitted say 'submitted' just before the form submission kicks the page over to the submitted.html

Form Repopulation on Redirect using ASP

I'm currently working on an application that uses ASP, and I am currently having difficulty repopulating the fields of a form after redirecting back to that form.
Basically, I have a form where a user can input data into it (Say, an admin creating a new user within the system). Upon clicking the "Submit" button on the form, it goes to a processing page (say, userproc.asp) where it does input validation and adds the user to the database.
My issue is when the input validation fails, the application needs to return the user to the Form, report the issue, and keep the form populated as it was before clicking on submit.
This is where my problem lies, as I cannot find a good way to get a form to repopulate properly upon redirecting back to it using ASP. We do not want to use Javascript either.
Any thoughts/suggestions?
Make the Action for the Form point to itself instead of to a different "processing" page.
Remove the "processing" code that performs the validation and "user creation" for the "processing" page and place it in a Class defined in a new ASP page. This page is code only (just contains this class).
Include the new Class asp file in the orginal form page. On receiving a post instantiate the class and call an "Process" method where all your original code will work.
Have the method return some indication of success. If it has succeeded now you could either redirect to a "success page" or simply include the success markup in the form page. If the processing is failed you return your original form with the addition that you can set the values for all the fields to the ones received.