Wicket form triggering a download - forms

I am working with Wicket, trying to create a form where users choose options which correspond to files, which are then merged when the form is submitted and are presented to the user. Currently, the onSubmit() code for the form looks something like this:
ResourceStreamRequestHandler mergedFileHandler = new ResourceStreamRequestHandler(new FileResourceStream(mergedFiles));
mergedFileHandler.setFileName(mergedFiles.getName());
getRequestCycle().scheduleRequestHandlerAfterCurrent(mergedFileHandler);
This works fine when the Submit button is clicked once as the file is offered for download, but when clicked again the page seems to reload itself and the onSubmit() method is not run. Is there a better way to do this, so the user can make changes and re-submit the form to get a different download without having to reload the page or re-enter their options?

Have you tried using AjaxSubmitLink, and then make sure you do not return the file names? It seems like you reload the entire form, and the file names are cleared during reload.

Related

TYPO3 Contact form plugin exists twice, also submitted twice

I have a submit form that is once displayed in a PopUp and once shown normal on the page. So I created it in a storage folder and used "insert record" for said plugin twice.
When I submit one of the shown forms, it will be executed twice. Anyone ever had this kind of problem?
The contact request form is selfmade.
You need to distinct your two plugins from each other. I assume you have two times the same plugin on the same page. If you submit your form, both of the plugins respond to the request, because they both feel responsible for it.
If you could give one of the plugins a different name, it would just respond to its own form, and the other plugin would not respond to the other plugins form.
try to modify your plugin so you can configure it to only show the form.then you use two different CEs: one to show only the form, the second to show the form and to handle the submit.
Other possibility: while you are handling the form store the information about handling somewhere and avoid a second handling on the same call

How can i have webdriver refresh but submit form data every refresh?

So essentially driver.refresh() does not submit form data for example a captcha on the page. If you refresh in a browser, a pop-up appears saying confirm form resubmission if you click continue the browser submits the form data and you don't have to solve the captcha again. Is there any way that I can automate selenium to confirm the form resubmission every driver.refresh() ?
Assuming this is an alert, which is what it appears to be, you simply add this line of code after you call for the driver to refresh.
driver.switchTo().alert().accept();
Yes, you could write a Custom driver class, which extends the selenium driver class you are using, and overwrite the refresh method(or make your own). But, that would be bad practice.
Since not all pages you automate against will have form data.

How to avoid displaying newsletter form if it is submitted or close once?

I am using mautic form.
I have added form code in my header script and this script always run on every page so how can I avoid to display that form if user close form or he has submitted it before.
Paste the script to the content of your page where you want the form to display. That way it will appear only on the page you want it to show up and on the place you want it to show up.
If you want to display another content after the form submission, configure the after submit redirect URL in the form's configuration.

How to update the responses of the google form to the form itself

I am creating a Google Form. I want to insert a count in the end(anywhere,not specific) of the form which will show the number of responses submit till date.This goes like updating the live count. I have tried using script editor for Google Form Add-ons option.But I am unable to view the results automatically or changes. It asks me to accept "Terms of Service" which I don't want to do right now because I am not sure about the way it may result.
There are various options available to view the form results/responses.But here I don't want to view the results later.They should get updated when we click the submit button on form.Please note..simultaneously many users may fill the form.
To implement this,I have thought of logic like whenever submit button gets clicked..the text in the form should get updated.
Please suggest how I can add the count or apply above logic of whenever submit operation is performed. Is it possible?? Any other suggestions are welcomed..Thanks in Advance!!!
I found another possible way of doing this..I received all the responses in Google Spreadsheet..which I later embedded in my site. Solves the purpose..And the embedded data gets updated automatically for the responses !! Cheers

Blue Imps jQuery file upload send files with form like normal field

Is it possible to send file with form as normal file upload? When I check a file field it is always empty, and I need to send it with form data in one call. IS that possible?
There might be better answers out there, but I ended up solving this by following steps.
Having 2 forms on the page. One for file upload and one for other form data.
Format both forms using CSS so that user gets look and feel of one form.
Have only one div (which looks like button) to submit. Hide the actual form's submit button, if you are using them (I don't. Because I preprocess data and then send by ajax)
Once user submits forms (by clicking the dummy button), Using JS programatically click the file upload button.
Optional Once that call is finished, if there are no errors only then continue.
Submit the form with other form data.
The advantage I had in this approach was that I could have more control over user's form data as well as my file upload's settings. Because I had some settings (like max number of files and max file size) were dependent on user's form entry.