-
AuthorPosts
-
August 10, 2011 at 2:17 pm #167252
To validate custom contact form with Jquery.js and Jquery.validate.js and some of javascript, can you tell me where to save js file and write the scripts?
Trimud FriendTrimud
- Join date:
- May 2006
- Posts:
- 245
- Downloads:
- 36
- Uploads:
- 11
- Thanks:
- 8
- Thanked:
- 55 times in 45 posts
August 10, 2011 at 4:14 pm #405437Hi,
in Your template settings go to Layouts tab and click edit on the Default layout.
Under </stylesheets> add
<scripts>
<file>js/jquery.js</file>
<file>js/jquery.validate.js</file>
</scripts>After this upload both files in templates/ja_travel/js
But first be sure that jquery.js is not yat loaded by some other joomla extension by checking sites source code.
Regards
August 10, 2011 at 6:07 pm #405463Thanks. After I add
<scripts>
<file>js/jquery.js</file>
<file>js/jquery.validate.js</file>
</scripts>
on the default layout xml file. However, slideshow on home page, mega menu and validation process don’t work at all. When I check the source code , there were two jquery.js even though those are not in the same folder. Will you advise me any other solution? Also, where do I put <script> code that is usually located in HTML page, such as<script>
$(document).ready(function(){
$(“#webtoleadForm”).validate();// Your code here
});</script>
Trimud FriendTrimud
- Join date:
- May 2006
- Posts:
- 245
- Downloads:
- 36
- Uploads:
- 11
- Thanks:
- 8
- Thanked:
- 55 times in 45 posts
August 10, 2011 at 7:03 pm #405472If jQuery is loaded 2 times remove:
<file>js/jquery.js</file>
Please read about jQuery noconflict mode here: http://www.google.bg/search?client=browser-rockmelt&channel=omniboxaq=1&oq=jquery+noco&sourceid=chrome&ie=UTF-8&q=jquery+noconflict+joomla
Why don’t you add custom JS to the form you created?
Regards
1 user says Thank You to Trimud for this useful post
August 10, 2011 at 8:56 pm #405492I found 2 jquery.js file inside following folder.
C:xampphtdocspaytmediacom_akeebajs and C:xampphtdocspaytpluginssystemjapopupthickboxjs
1. Can I remove only <file>js/jquery.js</file> or else?
2. Do I have to add another path to jquery.js onInside default layout xml file
<scripts>
<file>js/jquery.js</file>
<file>js/jquery.validate.js</file>
</scripts>3. How about <file>js/jquery.validate.js</file> ? Can I leave it as it is?
4. Where can I add custom js? Do you mean between <form> </form> tag? I tried to put custom js code outside <form>tag , but it didn’t work.
Many thanks in advance.
Phill ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
August 10, 2011 at 9:16 pm #405499If you are writing your own js why not use mootools rather than jQuery. That will avoid conflicts.
August 10, 2011 at 9:27 pm #405504I am not familiar with setting up validation on the form field. I heard that jQuery is the solution to validate each field. Can you tell me what is the best option for me? I am trying to put following form as attached inside single article. jQuery validation plugin works fine on one html page, but it is hard to put joomlart template. Regards,
Phill ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
August 10, 2011 at 9:48 pm #405509Just to get things straight, you simply want a custom form yes? There are simple components that you can use to generate those for you and will save all the messing about coding your own.
jQuery can be used or mootools can be used. They are basically the same thing but when you mix them on the same page you will get problems. This is especially true with Joomla as Joomla ships with Mootools and JA templates make extensive use of that. The reason your code is killing the menus etc is simply a conflict of the two libraries and you could use the jQuey no conflict mode. In my mind however simply using one of the custom forms plugins for Joomla, preferably one that uses moo, is a simpler and probably better way to go.
1 user says Thank You to Phill for this useful post
August 10, 2011 at 10:20 pm #405522Can you suggest one of forms plugins that uses moo? Actually the custom form is generated based on Salesforce.com web-to-lead code.
Phill ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
August 10, 2011 at 10:37 pm #405526If the form is generated by a third party component then probably best to ask them to add validation code.
If you want to create a form of your own then you could either try one of the cudtom contact form plugins available here – http://extensions.joomla.org/extensions/contacts-and-feedback/contact-forms
Or create your own form using one of the components here –
http://extensions.joomla.org/extensions/contacts-and-feedback/formsI use chrono forms as it is free and simple to use. Which is best for you is hard to say, give some a go and see if they fit your needs.
1 user says Thank You to Phill for this useful post
AuthorPostsViewing 10 posts - 1 through 10 (of 10 total)This topic contains 10 replies, has 3 voices, and was last updated by Phill 13 years, 3 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Where to add jquery.js and jquery.validate.js javascript file and script to validate?
Viewing 10 posts - 1 through 10 (of 10 total)