I am trying to use FormCheck for MooTools to validate a basic contact form I am planning to build. The problem is I can't seem to set up the script to work at all =(
If anyone knows about FormCheck or MooTools and can add any pointers they would all be greatly recieved.
My website is here: http://ryanis.me/
You are using jquery AND mootools on the same page? Why would you do that, it's a bad practice and bad form to stuff your users for two frameworks for what is a small page without anything complex. that aside, are you using the noconflict mode in either framework (note that this is only available since mootools 1.2.3 and requires some changes in the source code of the plugins, probably better off namespacing jquery)
first of all, you have a mootools domready function then you do inline js on the body tag onLoad...
then at the bottom of the source, you try the mootools domready again...
then you embed an accordion script (something that mootools can have built in as part of mootools-more). not sure what you use jquery for but you really need to structure your page better and pick a single framework.
the error you are getting in the formcheck js implies that either this.form is undefined (at time of evaluation $("contactform") was not available or that this.form.getElements() is not a valid method, which would imply that the mootools element prototype is not working. once again, are you using the noconflict mode?
it really needs refactoring and rethinking...
If you are using jQuery you may want to check out various jQuery plugins that will do form validation for you. The validation plugin works pretty well. If you want to use jQuery and MooTools together, you probably need to make sure that you are using jQuery in noConflict mode.
Related
I'm using Gantry template on Joomla! that has bootstrap integrated into it. I wanted to use the bootstrap javascript components, like lightbox, tabs. I added jQuery (no conflict) as mootools is already loaded, and then added the required code. But, it doesn't work as expected. I set up a test page at http://v2.marlownailandbeauty.co.uk/index.php?option=com_content&view=article&id=47&Itemid=127
Neither the tabs, nor the lightbox work (just below youtube vid). I can't see any JS errors, just wondering why it might not be working? Any bright ideas? :)
Looking at your code quickly, it seems to me that you load:
jQuery
JQuery no conflict
Mootools
Various other Mootools scrripts
To the best of my understanding, it's recommended to load jQuery (no conflict) after Mootools and all the other scripts have loaded: source http://docs.jquery.com/Using_jQuery_with_Other_Libraries
ie:
jQuery
Mootools
Various other Mootools scrripts
JQuery no conflict
A couple of ways to test this quickly. You could edit the template file directly and change the order, or use an extension like jQuery Easy to load the no conflict scripts.
Or a third option ... have you checked if you even need Mootools in your template? You could use an extension to disable mootools and see what happens. If you are lucky your template will still work well and your site will load faster. And it's easy enough to reverse if mootools is indeed needed.
Good luck!
we have a big ExtJS (still ExtJs 2) application, which provides windows explorer like functionality on a Java EE server.
We now evaluate implementing a new functionality; we could base this functionality on a jQuery plug in.
Is it recommended to use jQuery and ExtJs in one application?
Or will I have to deal with side effects occurring?
You will not have to deal with any side effect. The only problems I ever ran into when I did this is if I tried to operate on elements that Extjs relied on being left alone. Just make sure that when you start operating using jQuery that you're working inside a div that extjs doesn't plan to mess with. The best way to do this is to inherit from Ext.Component and then operate inside the div it provides. Ext doesn't do anything inside this div so you should be ok. You can also tap into the resize functionality if you need to, though this is not really necessary.
My company does so with no problems on a fairly large Apache/Catalyst site. We do use jQuery() rather than $() due to some old Prototype stuff on our site.
More: Blueprint CSS Extjs and JQuery in the same page, best way to make them coexist without conflict
keep jQuery within the jQuery namespace http://api.jquery.com/jQuery.noConflict/
Use it like so: $.noConflict();
jQuery only adds a single object (jQuery) to the window's context so you won't have any conflicts.
PROBLEM: Some third party libraries for jquery may rely on static webpage organization. As ExtJS components can be added to webpage dynamically - they will have no functions from third party libraries.
SOLUTION: You will have to run this library's script after component is added (use afterrender event, for example). Then you can call these functions on this ext component.
How do you guys resolve conflicts between Jquery plugins. A conflict would be a situation where two or more Jquery plugins (such as a file upload plugin) work properly alone but result in errors or unintended behavior when you include a second plugin.
I have this problem right now and I am considering using an iframe to isolate sections of my page from everything else. But I want to avoid this if possible to work out these conflicts.
Auditing the plugin code is not feasible its mountains of code and there are short development times to consider.
I can't use jquery.noConflict because I would have to fire it and then replace the $ with Jquery in ever line of my code. Editing the plugins is not feasible. I thought jquery.noConflict didn't work for plugins? It only works for javascript/jquery libraries? I'm not reffering to libraries. Just plugins like sliders, galleries, fileuploaders etc etc.
I used:
(function($) {
jQuery.noConflict();
});
Already..
After some digging around on the web I found some resources
Jquery Plugin conflict
How do I solve this jQuery plugins conflict?
http://forum.jquery.com/topic/jquery-plugins-conflict
And the last one
http://www.jotform.com/help/130-Fixing-Jquery-Plugin-Conflicts-jCarousel
It seems that everyone suggest to use noconflict but except for the last one who said it worked - I don't see a reason it should work, since in documentations JQuery explains that it was meant for libraries that don't use JQuery but collide with it. ( see the 3rd resource I pasted here).
Anyway, it seems as if the best option is to dive into the code and modify it.
i had an issue with jquery conflict, but my case was i had also used prototype.js. i worked out a solution for that. here is a pointer checkout if it helps.
jquery conflict occurs when "$" is also used by some other plugins. hence we need to define jQuery.noConflict
so that all the methods are called using some other reference in this case 'jQuery'.
try include the scripts files on the page as follows.
include all the jQuery files (library and all plugins which are dependent on jquery).
fire jQuery.noConflict();
include all other libraries/ plugins.
wherever jquery methods are called use "jQuery" istead of "$"
hope this helps you out..
Hi I need Mootools for my chronoforms, prototype for my lightbox 2 (I think) and maybe also some jQuery in the future.
When I enable Mootools, lightbox 2 is not working in IE, when I disable it, lightbox works fine but I get errors on my page from my chronoforms form.
Is there a good and easy way to make sure you don't get any problems using all three together?
And something like JQuery.noConflict() is not an easy solution.
You cannot have MooTools and Prototype co-exist.
This is because they both change (extend) native host objects (Types) like Element (MooTools) and Array, Function, String, Number (both). You can't noConflict this for the life of you, each method can be defined once.
It's going to be pot luck when you reference "foo".contains('oo') and it goes to String.prototype.contains (for instance) if you get Prototype's, Mootools or ES5's implementations (MooTools 1.5.1+).
Time to reconsider what you use as you really should go to a single framework - they all can do what you need individually.
You can also have MooTools + jQuery or Prototype + jQuery, however
I'm trying (and for the most part succeeding) to use the tipsy jQuery plugin in my greasemonkey script. I am using the #require meta tag to import the jquery and tipsy js, and it works, but with a couple caveats which I'm trying to overcome.
Accessing elements as a pure jQuery object fails, so I'm relegated to using DOM functions to get my elements:
//this fails
$('#login').find('a:first').tipsy();
//while this succeeds
$(document.getElementById('login').getElementsByTagName('a')[0]).tipsy();
Anyone know why? Need more info? TIA!
I think it's because inside Greasemonkey, jQuery has a different default context than the document. Try this:
$("#login", document).find('a:first').tipsy();