<form ... id="form-id-1" class="form-validate"/>
<input form="form-id-2" type="text" name="jform_field_a" class="required" />
...
</form>
<input form="form-id-1" type="text" name="jform_field_b" class="required" />
Field: jform_field_a is not included in the validation
Field: jform_field_b is included in the validation
Neither of the above is happening
any
Title |
|
Title |
|
Title |
|
Title |
|
Category | ⇒ | JavaScript |
Labels |
Added:
?
|
@dgt41 could you take a look at this please
I am gonna make a pr with vanilla validation.js and will use @ggppdk code from the comment above.
The idea is to allow html5 pattern tag to be used wherever is set.
Also fix the current jquery version although I think we just replace it with native code. Validation is not doing something extraordinary to need jquery.
I am using this to get all form elements
$form.find('fieldset').toArray().concat(Array.from(form.elements)) ;
Also to get elements on specific container that is added at runtime i am using:
attachToForm = function(form, container)
{
var inputFields = [], elements,
$form = jQuery(form);
var elements = typeof container !== 'undefined' && container ?
jQuery(container).find('input, textarea, select, fieldset, button').toArray() :
$form.find('fieldset').toArray().concat(Array.from(form.elements)) ;
I am on my mobile right now but if I remember correctly all you have to do is push the new elements to the relative (form) array. I don't think it's tricky
Also if the events part of #11378 are available then validation can be triggered on each field as the users enters data, which will improve the UX/UI a lot (think of a green tick or a red x depending on the validity of the entered data, in real time).
Although all these can be done with the current jQuery code I think that moving as much javascript to native code will improve Joomla (especially in the long run, e.g. in 1-2 years Bootstrap 5 will be out and guess what? no freaking jQuery!)
About IE8 / IE9 and early versions of IE10 not supporting the form="..." attribute
i am placing the elements back into
<form>
</form>
before submiting, so submiting works for them too
Also it is ok if for these browsers (IE8 / IE9 and ?early? versions of IE10) if validation does not work for fields that use form="..." attribute and are placed outside of FORM tag
just now it does not work for any other browsers (which are 96%)
i am just calling for an improvement for the future
@dgt41 can this Issue be closed?
Status | New | ⇒ | Information Required |
closed due to lack of response
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-21 15:22:52 |
Closed_By | ⇒ | brianteeman |
I found when bug was introduced:
This commit had replaced mootools code with jQuery code
763c69f
But also the old mootools code:
was replaced with this code that introduced the bug:
correct one would be: