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

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.

Related

Load data saved in form on a new form

I need to use Orbeon Forms to create a form to capture the price from a number of things. I create a form, connect it with database (MySQL), deploy the form, complete the form, and it saves the data correctly in database.
Then my question is: if I complete form_1 and save the data in the database, and later enter to the empty form_1:
Is it possible to load the data entered previously or from the last form completion for form_1?
Is it necessary to have button or any control to take an action?
When you load a page to fill a new form, notice how the URL ends with /new. When you are on that page, and save, notice how the URL changes to /edit/123 (where 123 is a long unique identifier). You can come back to edit the data by loading again this URL.
In practice, this is often done by going to the /summary page for the form, and clicking on the relevant form data you want to edit.

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.

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

acrobat pdf submit button for forms - fields order in xfdf

My solution:
User opens PDF file on web server in browser.
User is entering form fields and pushing submit button.
Submit button sends XFDF data through POST to my PHP script.
When I get POST data, form fields are in random order.
I'm creating XFDF document based on POST and then process it further. Preferably fields should be in the same order as in PDF file.
Question:
I don't know how to control adobe reader to send form data in some predictable order. Form fields numbering (controlling flow of document when using TAB) is not changing resulting POST data order.
Any ideas how to order fields?

Email submission form with attachments (add, open, and remove) in spring mvc

How can I create a email form which allows user to specify:
To
Subject
Attachments with Add/Open/Remove facility
send/cancel button
I'm having trouble to send the index of the file the user want to remove , for example if the user attached file1, file2, and file3 in the email submission form and I captured this info in the controller as key,value pair where key is index and value as file name. But the user is allowed to remove arbitrary file before sending the email, for example the user clicks 'file2' remove button. Now in the controller I want to grab the index of the file need to be removed, but this is dynamic since user can click any of the attached files remove button.
I'm using spring 2.5 with JSP/JSTL as view component.
Please see the sample email form:
To |_________________|
Subject |________________|
Attachments: [**ADD**]
**X** file1
**X** file2
**X** file3
(click the 'ADD' button to attach file, click 'X' to remove corresponding attached file,click on the file name to view/open the file contents)
If removing is handled at the server side, you can implement remove buttons as a <button> tag, where name is, say, fileToRemove and value is an index of the file. When user click that button, the form is submitted with fileToRemove=... parameter:
<button name = "fileToRemove" value = "${file.id}">Remove</button>
Thanks Axtavt, but we are using IE6 as client browser and the following is known issue:
Meanwhile, the button element allows authors to produce buttons that submit data to the server that does not match the text displayed on the button. Delete should submit to the server row_to_delete=1 but Internet Explorer will send row_to_delete=Delete. If IE could be persuaded to behave, then this would also be useful for multilingual sites – the text displayed could be translated for each language, but the value could remain the same so the server side logic wouldn’t need to check the translation table.
It gets worse though, Internet Explorer 6 has a further bug where it will treat all elements as successful controls, and submit their data to the server, even if they were not clicked. This effectively makes using multiple button elements impossible.