JHtmlBehavior::formvalidation() #1546
Comments
Mootools-more is not required for form validation to work in Joomla 2.5.x, so I'm not sure why they make that change, seeing that J!3 is more bent towards jQuery instead. I'll need to look into this more. |
It is required to use function isValid() |
Please apply this update before releasing Joomla! 3.0 because my extension use this function from Joomla! validation script and it would not work |
Is this an extension you have distributed? Or one you are working on for a client? If it's the latter, you can add the call to I'm only giving these suggestions because I'm not sure if this can make it in on time, since 3.0 is scheduled for release tomorrow. |
Did Hash move between MooTools Core and More by chance? |
Looks like Hash was always in More, but in J!2.5.x, there was a MooTools 1.2 compatibility in mt-core that provided some type of hash compatibility. See https://github.com/joomla/joomla-cms/blob/2.5.x/media/system/js/mootools-core-uncompressed.js#L412 - That compat section been removed in the 3.0 branch. So, to answer the question, it hasn't moved, but the compatibility layer was removed. |
That removal was intended. So if we need to ensure MT More is loaded for that, then this fix will work. Care to do the pull request? |
I have better solution. I have upgraded Joomla! validation script to work without Hash. ...
|
Pull request away - I like the that implementation since the validation script only requires that one simple feature of the Hash js. No need to load the full More library. |
By the way I have related improvement into validation script posted on |
In Joomla 3.0.1 it was not updated. Should I do something with this topic? |
3.0.1 was primarily security and critical bug fixes around update work that needed to be done. It might get picked up in a later release if someone merges platform back down to the CMS after it gets fixed in the platform or alternatively you can push to get it fixed in the CMS. TBQH it sounds more like a CMS issue more than a platform issue. |
Since MooTools 1.3 most of Hash functions has been moved to Object (which is part of Mootools Core) and documentation discourages using Hash class (When possible, please use the Object type!). A while back I refactored the Validator script to act as a wrapper to MooTools native Form.Validator and optionally use HTML5 validations. The code is heavily commented, contains backward compatibility methods to current version of validator.js and is simpler. |
This code looks nice. I will have to test it. I think that it is high time to rebulid Joomla validation. Check also if it would validate multiple select list as required |
This hasn't been tested much, just few forms on frontend and backend in joomla 2.5. |
Why was this ignored for 3.0.1, pasamio's reason is not good, because this is a simple and mandatory feature in Joomla's core. My registration form's return no value's. Is there a fix or branch for this I could use? |
You can edit the files for your site, and then when this get's merged into I wrote this up for overriding core Joomla classes with your own code - |
Thanks dongilbert, the problem is I'm not too sure what I need to override, or what code I need to make it work. I was hoping someone who fixed this had a branch, or some code to copy. I'll give it a shot though. |
Add to your form temporary PHP code:
to solve this issue. You might also override JavaScript class with isValid method by adding following code to your form JS file:
|
Thanks piotrmocko, but I changed self::framework(); to self::framework(true); in libraries/joomla/html/behavior.php, method formvalidation(), but it made no difference. I am only trying to fix the Joomla registration form here, which does not return any warnings or errors. |
@awc737: If no, maybe we should move the discussion to Google groups.. pasamino is right, there's kind of confusion with javascript supplied with the platform. If platform is to be as slim as possible, these assets should move to the CMS. Besides Joomla 3.0.x is running on Platform 12.2, but current platform version is tagged 12.3. |
On that demo piotr-cz, shouldn't clicking 'Register' with all fields blank, or all invalid fields, at least return some kind of message, like a tool tip response or something? |
If you click on the field it is highlighted red. Near as I can the field is tagged with the class "invalid" as is the label. The label also has an It is up to the template to decide how it wishes to render invalid fields. In this case the red highlighting doesn't occur unless you've clicked on the field. This is likely a bug in the CSS for the template that needs to be looked at so that it continues to highlight invalid fields that are not active. The template isn't something that the platform distributes but is in this case the CMS. So as I noted before, I do not feel this is not a platform bug but a CMS bug. You're welcome to submit a pull request here to change that but we'll likely defer to the CMS folk as they're the ones most likely to be impacted by the change. However as I noted it doesn't mean it will immediately be available until the CMS chooses to pick it up from the Platform project. Finally the Platform doesn't decide what goes in the CMS releases. The CMS is a downstream consumer of the Platform and as such we don't directly control what does or doesn't go into it's releases. While the CMS is certainly a source of fixes and improvements for the Platform, when it updates it's copy is on it's terms not ours. As I noted earlier the 3.0.1 release was a security release which the Joomla CMS typically stays away from making big changes in so that people aren't afraid that their site will be broken. This means only critical fixes and the security fixes usually go in. This is why something like this, apart from not even being fixed in the platform or a registered bug for the CMS, wasn't included or would be likely to be included. |
@awc737 In my opinion it should immediately change border-color of invalid fields to red, like it has been happening in previous Joomla versions (maybe that's something that has been overlooked?). Anyway as pasamino suggests, this can't be fixed here as this is a template thing and platform is not being shipped with templates. Try to add an issue or pull request in the CMS tracker, I'm pretty sure that more people are annoyed with this behavior. Quick fix could be to prepend We are discussing something quite different here: in some cases validator dependecies are not loaded/ how to make it lightweight. Edit: This commit probably fixed invalid input filelds styling |
JavaScript form validation does not work because mootools-more is not loaded.
file:
libraries/joomla/html/behavior.php
method:
formvalidation()
change:
self::framework();
to:
self::framework(true);
Joomla 3.0 Beta 1
The text was updated successfully, but these errors were encountered: