-
1. Re: comments required fields
thetrickster888 Aug 8, 2013 2:06 PM (in response to river east)Just have to add a line to that "checkWholeForm" function. Just above the line that says "if(theFrom.EmailAdress)" etc, add this line:
if (theForm.FullName) why += isEmpty(theForm.FullName.value, "Name");
-
2. Re: comments required fields
river east Aug 8, 2013 2:16 PM (in response to thetrickster888)Thanks for that trickster. Tried it however and it didnt work. The only alert the shows up is for the enter word validation.
-
3. Re: comments required fields
thetrickster888 Aug 8, 2013 2:22 PM (in response to river east)I think I see what's going on... somehow the "name" attribute on your form inputs are lowercase-- when you insert the comment form into a page both the email address and full name input fields should have camelcase formatting, so try these inputs instead:
<input maxlength="255" name="FullName" class="cat_textbox_small" />
<input maxlength="255" name="EmailAddress" class="cat_textbox_small" />
Notice the name attribute has camelcase capitalization.
-
4. Re: comments required fields
river east Aug 8, 2013 2:28 PM (in response to thetrickster888)That my friend solved it. Thanks for the insight, very much appreciate it.
-
5. Re: comments required fields
Liam Dilley Aug 8, 2013 2:58 PM (in response to river east)As an extra note if you are using the HTML5 doctype you can just do required="required" (SO BC does not kill it) and you have HTML form field validation.
-
6. Re: comments required fields
thetrickster888 Aug 8, 2013 3:27 PM (in response to Liam Dilley)Yes, but if you do that you'll need some sort of fallback/polyfill for browsers like IE8-9, Android and iOS 6 and down that don't support HTML5 form validation. It says Safari has partial support but I haven't tested that.
-
7. Re: comments required fields
Liam Dilley Aug 8, 2013 4:27 PM (in response to thetrickster888)IE9 supports HTML5
It is a nicer way for form validation before the BC one kicks in. I do this by default on all forms that kicks in before javascript. It is the way forward.
For this and placeholder the javascript code for validation is very small.
I have one that converts placeholder for IE - few lines of code.
I have a function that is my own field validation, the element for required is just a couple of lines of jQuery and looks for required and uses name for the alert.
Since I overide default alerts for better ones as well I also have that and fall back for default on mobile devices.
For most people using default is fine of course but anyone wanting to explore options these are the sort of steps you can take on BC forms and have better validation and ease of use setup etc. Defiantly posible with very little scripting.
-
8. Re: comments required fields
thetrickster888 Aug 8, 2013 5:53 PM (in response to Liam Dilley)Of course IE9 supports HTML5, but it does not natively support the "required" HTML5 form validation feature. I linked to the caniuse website that shows support for the "required" HTML5 form validation and it is only supported in about 65% of browsers.
I also tested this demo: http://jsfiddle.net/thetrickster/hF5qL/embedded/result/
I tested it in IE9 and it doesn't work. I wasn't saying IE9 doesn't support HTML5.
-
9. Re: comments required fields
Liam Dilley Aug 8, 2013 7:45 PM (in response to thetrickster888)Just double checked and is doing for me



