I have an episerver Multi step form. Except for the last step that has an optional comment input and the submit button all the steps includes mandatory fields. If I try to manipulate the html on the browser to make submit button visible, the validation except in the 1st step fails and I am able to submit the form.
Shouldn't validation fail in such a scenario?
Do I have to explicitly use the dependencies tab?
I have gone through episerver documentation for multistep scenario but couldn't find any thing close to how validation works.
Any inputs on how episerver multi step form validation works is appreciated.
Below is the rendered HTML of the last step with Submit button. Clicking the submit button, prompts me to fill in the details for the 1st step which on providing the required details & again clicking the submit ,the data gets posted & the confirmation message is displayed.
***`
<section id="__field_7239" data-f-type="step" data-f-element-name="__field_7239" class="Form__Element FormStep Form__Element--NonData" data-f-stepindex="5" data-f-element-nondata="">
<h3 class="FormStep__Title">Additional Information</h3>
<aside class="FormStep__Description"></aside>
<!-- Each FormStep groups the elements below it til the next FormStep -->
<div class="Form__Element FormTextbox FormTextbox--Textarea" data-f-element-name="__field_7201" data-f-modifier="textarea" data-f-type="textbox">
<label for="e32739e7-04e5-47d0-b9c5-0c4d6d0e1644" class="Form__Element__Caption">Message</label>
<textarea name="__field_7201" id="e32739e7-04e5-47d0-b9c5-0c4d6d0e1644" class="FormTextbox__Input" placeholder="Message" data-f-label="Message" data-f-datainput="" aria-describedby="__field_7201_desc" aria-invalid="false"></textarea>
<span class="Form__Element__ValidationError" data-f-linked-name="__field_7201" data-f-validationerror="" id="__field_7201_desc" style="display:none"></span>
</div>
<button id="bf44f17c-3613-404c-b02f-5968d66dbc05" name="submit" type="submit" value="bf44f17c-3613-404c-b02f-5968d66dbc05" data-f-is-finalized="true" data-f-is-progressive-submit="true" data-f-type="submitbutton" data-f-element-name="__field_7184" class="Form__Element FormExcludeDataRebind FormSubmitButton">
Submit
</button>
</section>
***`
I have this
<form id="form_837299" class="appnitro" method="post" action="insert.php"> <paper-input label="Title" name="title" maxlength="255">
</paper-input>
<paper-input floatinglabel multiline label="text" name="text"></paper-input>
<li class="buttons">
<input type="hidden" name="form_id" value="837299" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
I have problem with POST data - nothing is sended in "text" and "title" (all in paper-input).
I modified the template and attribute "name" now is in one div, which Polymer created. But no data are sent.
print_r($_POST); shows me only this:
Array ( [form_id] => 837299 [submit] => Submit )
Anybody knows how use Polymer and Material UI on form?
Only elements that extend native form elements automatically get submitted with forms. paper-input extends core-input which has an input inside it as opposed to extending it. See this mailing list discussion for additional discussion and this StackOverflow post for possible solutions.
Something like this jsbin maybe?
Update: Here's the same thing in web component form.
Update: Looks like the creator of ajax-form has added this functionality.
Update: Also consider using iron-form.
According to the Polymer docs the way to do this is to just create a regular form input and wrap it in the <paper-input-decorator>
https://www.polymer-project.org/docs/elements/paper-elements.html#paper-input
I've tried it out and it works fine. Some better form support would be cool, but oh well. This stuff still kind of rocks.
UPDATE: I've built a bower package (polymer-rails-forms) to deal with forms in polymer, tailored specifically to the ActiveRecord input naming scheme but it will work with any old form really. It's still relatively new, but it covers most input types, basic validations, xhr and non-xhr submits and has a couple cool extras like image, json, and location* fields.
the location fields depend on the Google Map Places API
I'm using ExpressionEngine and Safecracker to build a simple Facebook app that runs inside of a FB page.
My code functions properly outside of the Facebook page, but inside the page it shows a blank screen. I've been able to narrow it down to this piece of code:
{exp:safecracker channel="lekker_fietsen_competitie" return="/"}
<input type="text" name="title" value=""><br>
<textarea name="description"></textarea><br>
<input type="file" name="image"><br>
<input type="submit">
{/exp:safecracker}
I'm guessing that Safecracker is somehow violating what I can and can not do inside a FB page, but I can't see what it is.
Things I've tried:
hidden fields are allowed inside a FB page, they work properly, so they are not the cause of the problem
the scripts and other stuff that's generated by Safecracker works inside the FB page; I've
hard-coded all of it and there seems to be no problem if hard coded
You'd say the solution is easy: hard code the form. But I can't, because the form has two fields like ExpressionEngine needs to write the entry:
<input type="hidden" name="meta" value="cIssFx0NbcTnVxs7mWiSvwx0OwJ62c0KKoeGbZu8RMTHMJfNsv/OS0q8mtPh9HLmu/
ru2n8a5J4S3wgyB8c+XWBdNfUrTCeWNrKYwDOxSkxB34I5UNN8XpVQt/
wYc5FajtTx4VyGomwAHZ0vC7gXTxH4cYhU/zGx7S/UB6DgAyKk3cnl2f3+zbDId
+KbU7msE0O1AJX3Nx7QaE6IpKJpXnQeiMISCHC1aOxJriZ/5eWIhqZdDz18rRbs4
kdHCQ9RChFPtiB4rtjxque1CGylWj+OjiTaEVA68IVmC7c3AFrL9Wf4wxojOchPmlEx
0W2OD5T/ERy0mV6GbCnkAZcQRdQjgjx3Rd7SQrXOO6u7gHh+vqrzw/y/y7dqlMz1LGmrj
kdnOqdM/9bPej8Sp+3dCo2mDjf4WgCfLKze3P7XgLc=">
<input type="hidden" name="XID" value="1fba9120c5e00cfcb665bd0c7e147757b7888847">
So, where to go from here? What terms/guidelines might I be violating?
I submitted a ticket and did the following. Naviagate to expressionengine -> libraries -> Cp.php and go to line 75. Ticket https://support.ellislab.com/bugs/detail/19663
ee()->output->set_header('X-Frame-Options: SameOrigin');
Replace with
if (isset($_GET['D']) AND $_GET['D'] == 'cp')
{
ee()->output->set_header('X-Frame-Options: SameOrigin');
}
This is quite a common question but the solutions I found in other people posts are either related to a specific browser (mostly firefox) or incorrect usage of names (name="U12-678132-34")
My issues are with browsers other then Firefox (Firefox all ways works).
The form that I use is pretty standard HTML form but the submission of it is done with javascript (jQuery AJAX).
Firefox all ways asks to remember the password (if it is a new user) and refills the form if you land on that same page again. But when it comes to Chrome/Safari/IE8-9 then they never request to save a password if the form is submitted with javascript.
(By the way I did check if the browsers dont have the - never remember passwords turned on)
My submit happens when you click on the link inside the form or if you just click the "ENTER" button on your keyboard, then it initiates the $.submit() method.
Is there a specific way that the submit needs to occur so that the browser would request to save a password like firefox does? or is there a way to at least tell a specific browser like Chrome/IE to force that type of request?
Form example:
<form class="loginform" method="post" action="">
<div class="inputfield">
<input name="email" type="text" class="emailaddress inputclass" value="" title="Email Address" />
</div>
<div class="inputfield">
<input name="password" type="password" class="password inputclass" title="Password" value="" />
</div>
<div class="submit">
<div class="checking">
<img src="/preloaders/login-preloader.png"/>
</div>
<input type="submit" name="submit" value="submit" style="display:none"/>
</div>
</form>
This is browser behaviour and can't really be changed. Firefox might be "smart" enough to offer to save passwords without the form actually being submitted, but that risks having buttons in the form also trigger that option even if the button does something different. So in my opinion, it's a bad thing for Firefox to do (I've had many problems with Firefox submitting forms even though it shouldn't).
If you really want the save password option to show up, use an iframe and submit to the iframe, instead of using AJAX. You could then use AJAX from the iframe to keep the old behaviour.
attach click event to your submit button
$('#id_of_submit').click(function() {
/your ajax logic
return false;
});
and on link
$('#id_of_your_link').click(function() {
$('#id_of_submit').click();
});
this will do the trick.
Looking at the answer accepted on here - How can I get browser to prompt to save password? - it seems that a valid action might help.
But i would suggest its down to browser behaviour and cannot be controlled by HTML and/or JavaScript. If you want to remember the values entered use a Cookie
As u r doing an AJAX post, then-
Remove the <form> tags
instead of <input type="submit", use button
take the field values & AJAX post- on button click event
it might do the trick.
One of the reason is that site should have a valid certificate. If it is not secured site, password save prompt will not appear after login.
I have a submit form and want it to open a new window when users submits the form so i can track it on analytics.
Here is the code I'm using:
<form action="http://URL at mailchimp subscriber URL.com" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" onclick=window.open(google.html,'','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');>
<label for="name">Your Name</label><input type="text" value="" name="FNAME" class="required" id="mce-FNAME">
<br/>
<br/>
<label for="email">Your Email </label><input type="text" value="" name="EMAIL" class="required email" id="mce-EMAIL">
<br/>
<br/>
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="submit">
</form>
</div>
No need for Javascript, you just have to add a target="_blank" attribute in your form tag.
<form target="_blank" action="http://example.com"
method="post" id="mc-embedded-subscribe-form"
name="mc-embedded-subscribe-form" class="validate"
>
In a web-based database application that uses a pop-up window to display print-outs of database data, this worked well enough for our needs (tested in Chrome 48):
<form method="post"
target="print_popup"
action="/myFormProcessorInNewWindow.aspx"
onsubmit="window.open('about:blank','print_popup','width=1000,height=800');">
The trick is to match the target attribute on the <form> tag with the second argument in the window.open call in the onsubmit handler.
For a similar effect to form's target attribute, you can also use the formtarget attribute of input[type="submit]" or button[type="submit"].
From MDN:
...this attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a browsing context (for example, tab, window, or inline frame). If this attribute is specified, it overrides the target attribute of the elements's form owner. The following keywords have special meanings:
_self: Load the response into the same browsing context as the current one. This value is the default if the attribute is not specified.
_blank: Load the response into a new unnamed browsing context.
_parent: Load the response into the parent browsing context of the current one. If there is no parent, this option behaves the same way as _self.
_top: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as _self.
onclick may not be the best event to attach that action to. Anytime anyone clicks anywhere in the form, it will open the window.
<form action="..." ...
onsubmit="window.open('google.html', '_blank', 'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');return true;">
The code you have given, needs to be corrected. In form tag you have to enclosed the onClick attribute value in double quote:
"window.open('google.htm','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');"
You also need to take care that first parameter of window.open should also be enclosed using quotes.
I generally use a small jQuery snippet globally to open any external links in a new tab / window. I've added the selector for a form for my own site and it works fine so far:
// URL target
$('a[href*="//"]:not([href*="'+ location.hostname +'"]),form[action*="//"]:not([href*="'+ location.hostname +'"]').attr('target','_blank');
i believe this jquery work for you well please check a code below.
this will make your submit action works and open a link in new tab whether you want to open action url again or a new link
jQuery('form').on('submit',function(e){
setTimeout(function () { window.open('https://www.google.com','_blank');}, 1000);});})
This code works for me perfect..
window.open doesn't work across all browsers, Google it and you will find a way of detecting the correct dialog type.
Also, move the onclick call to the input button for it to only fire when the user submits.