Marketo duplicated form validation - forms

I have a problem with duplicated Marketo Form. I have 2 exactly the same forms on a page. First one is displayed in the content section of the page, the second one is diplaying in a popup when some button is clicked.
The issue is that when I submit the first form which is blank the validation messages are displaying for the second form in a popup.
I understand that the problem is that 2 forms have the same ID.
Is there a way to have 2 exactly the same Marketo forms working well on a page?

The problem is that when the Marketo form is embedded, it gives the <form> element a unique ID attribute based on the form ID. When you put the same form on the page twice, it puts two <form> elements on the page with the same unique ID, and - apart from that being invalid HTML - it means when you submit one form, it tries to submit both forms.
I'm not sure if it is possible - but there may be a way to use javascript to dynamically alter the <form> ID after it has been loaded into the page, therefore giving you two separate unique IDs... YMMV!
The only other workaround I've used was to duplicate the form in Marketo, and have a 'form A' and 'form B'.

Related

tx_form multiple times on one page via RECORDS

via TypoScript i generate a HTML-Table and on every line i add the same formular (tx_form formular) via RECORDS. The form can be opened in a lightbox and all is fine but when i submit one of these, all forms will be submit and i receive 16 mails.
How can i separate the forms? RECORDS is needed because i build the table in TypoScript and so i can update the form in the backend and all forms on the page are updated.
Is there a parameter which i can set unique via TypoScript for every record so every form is technical a single form?
I would use some javascript to iterate over the forms and make them unique.
As this might conflict with the secutrity mechanism from TYPO3 you alternatively can use javascript to remove other than the currently clicked form from the page. This might need a reload from the page if you have no special answer page for the form.

HTML form in 2 pages and submit on second page - how to achieve?

I have 2 jsp pages with forms and in first jsp page, once the user fill the form then they will click on 'continue' button and in the second page they have to enter data for few more form fields and do submit. once they do submit then data from 1st jsp and 2nd jsp need to be updated to backend. My question how i can submit the form in second page with first page data included
Store the user input from the first form in <input type="hidden"> in the second form. If there are are file inputs, then you'll need to store the file on the server and include some kind of reference (like a unique id or a URL) in the input.
Alternatively, you could use a session (but that risks a race condition if the user fills in two copies of the form at the same time across multiple tabs in their browser).
Alternatively, you could store the data in its final destination (e.g. a database table) with a flag on it marking it as a draft. Then update it with the rest of the data and remove the flag when the second form is submitted.

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.

Can you post fields from one form to another form using Webform in Drupal

I'm using Webform in Drupal to make this page:
http://www.stuffusell.co.uk/drupal-7.4/collection-form
I want to build another child form on the home page and submit all fields (two or three in total) from that form to the corresponding fields on the fuller parent form on the link above.
I'm hoping to do this using Drupal, Webform and any suitable plugins. Is this possible?
You may try to take a look at Prepopulate module.
It allows you to populate a form's fields passing the values in the url. You just have to create your home form with the good fields'names, form action to your webform and form method to "get".

How to get browsers to selectively ignore HTML5 required attribute on forms

I've got a standard HTML form, which is split into two sections using fieldset elements. One section is to enter name, email address etc and the second section is to enter the postcode for an address auto-complete feature (the postcode lookup field in the second section does not have a required attribute).
Each section has its own submit button. Each of the fields in the first section has a form field with a HTML5 required attribute.
My question is, when a user enters their postcode into the postcode lookup field without entering anything in the first section, all fields in the form are submitted in browsers which don't support this attribute (e.g. Firefox 3.6). In Firefox 4 (for instance), it honours the required attribute and prevents submission of the form if there are empty fields with a required attribute. However, this breaks my implementation of the error-checking and validation of the form (server-side, in PHP).
So, is there a way of being able to tell the browser to (in this case) ignore the "required" attributes of the first section when the submit button of the second section is pressed?
I understand this may be going against the point of the required attribute, but I've built the form so it doesn't have to be completed in a certain order, i.e. A user may choose to complete the postcode lookup field before entering their personal details, but the required attribute is currently forcing the user to complete the form in a certain way, when it isn't necessary to do that.
Also, any solution must be able to work without JavaScript. Please don't mention any answers advocating replacing the postcode lookup section with Ajax, it has been decided for me that this is not an allowed option.
I think I see your problem. I don’t believe there’s anything in HTML that lets you specify this more complicated validation rule. I think you’ll have to either:
Split these fieldsets out into two separate forms on the page;
Use two separate forms on two different pages; or
Re-write your server-side code so that the non-postcode form fields only include the required attribute when the user has submitted a postcode.
Is there any nested form in your page?. first form tag not work in nested forms like below. in that case use empty form tag to avoid error. and also do not write class with form tag starting like form.filed{}
<form>
main form
<form> </form>
<form> form1 </form>
<form> form2 </form>
</form>