Question

I'm a new to joomla. Currently i working on a project which need to be use joomla to complete it. But i'm having trouble on my joomla page. Here is the case, when i try to run up my code in my computer (localhost), everything run smoothly but when i upload all the necessary files to the server which i using cPanel and i include all the file path in my joomla article which i using Sourcerer plugin to insert the code inside my joomla article. The form and css is run correctly, but the javascript won't load up what it supposed to validate on the form.

Is my article having some code error? I'm using Joomla 3.0 with GoDaddy hosting. It should be something like this [here]http://doptiq.com/smart-forms/demos/samples/elegant/validation.html Here is my joomla form which the javascript won't function [here] http://joomla.matedis.com/pay-rate-form

And here is how i include the js file inside the Joomla article with sourcerer

{sourcerer}
...
<link rel="stylesheet" type="text/css" href="home/matedis/public_html/joomla/PayRate/css/smart-forms.css">
<link rel="stylesheet" type="text/css" href="home/matedis/public_html/joomla/PayRate/css/font-awesome.min.css">


<script type="text/javascript" src="home/matedis/public_html/joomla/PayRate/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="home/matedis/public_html/joomla/PayRate/js/jquery.validate.js"></script>
<script type="text/javascript" src="home/matedis/public_html/joomla/PayRate/js/additional-methods.js"></script>
...
<script type="text/javascript">

$(function() {

/* @custom validation method (smartCaptcha) 
------------------------------------------------------------------ */

$.validator.methods.smartCaptcha = function(value, element, param) {
return value == param;
};

$( "#smart-form" ).validate({

/* @validation states + elements 
------------------------------------------- */

errorClass: "state-error",
validClass: "state-success",
errorElement: "em",

/* @validation rules 
------------------------------------------ */

rules: {
firstname: {
required: true
},
lastname: {
required: true
}, 
useremail: {
required: true,
email: true
},
website: {
required: true,
url: true
}, 
language: {
required: true
}, 
upload1: {
required: true,
extension:"jpg|png|gif|jpeg|doc|docx|pdf|xls|rar|zip"
},
mobileos: {
required: true
},
comment: {
required: true,
minlength: 30
},
mobile_phone: {
require_from_group: [1, ".phone-group"]
},
home_phone: {
require_from_group: [1, ".phone-group"]
}, 
password:{
required: true,
minlength: 6,
maxlength: 16 
},
repeatPassword:{
required: true,
minlength: 6,
maxlength: 16, 
equalTo: '#password'
},
gender:{
required: true
},
languages:{
required: true
}, 
verification:{
required:true,
smartCaptcha:19 
},
applicant_age: {
required: true,
min: 16
},
licence_no: {
required: function(element) {
return $("#applicant_age").val() > 19;
}
},
child_name: {
required: "#parents:checked"
} 

},

/* @validation error messages 
---------------------------------------------- */

messages:{
firstname: {
required: 'Enter first name'
},
lastname: {
required: 'Enter last name'
}, 
useremail: {
required: 'Enter email address',
email: 'Enter a VALID email address'
},
website: {
required: 'Enter your website URL',
url: 'URL should start with - http://www'
}, 
language: {
required: 'Choose a language'
}, 
upload1: {
required: 'Please browse a file',
extension: 'File format not supported'
},
mobileos: {
required: 'Please select a mobile platform'
}, 
comment: {
required: 'Oops you forgot to comment',
minlength: 'Enter at least 30 characters or more'
},
mobile_phone: {
require_from_group: 'Fill at least a mobile contact'
},
home_phone: {
require_from_group: 'Fill at least a home contact'
}, 
password:{
required: 'Please enter a password'
},
repeatPassword:{
required: 'Please repeat the above password',
equalTo: 'Password mismatch detected'
},
gender:{
required: 'Please choose specie'
},
languages:{
required: 'Select laguages spoken'
}, 
verification:{
required: 'Please enter verification code',
smartCaptcha: 'Oops - enter a correct verification code'
},
applicant_age: {
required: 'Enter applicant age',
min: 'Must be 16 years and above'
},
licence_no: {
required: 'Enter licence number'
},
child_name: {
required: 'Please enter your childs name'
} 

},

/* @validation highlighting + error placement 
---------------------------------------------------- */ 

highlight: function(element, errorClass, validClass) {
$(element).closest('.field').addClass(errorClass).removeClass(validClass);
},
unhighlight: function(element, errorClass, validClass) {
$(element).closest('.field').removeClass(errorClass).addClass(validClass);
},
errorPlacement: function(error, element) {
if (element.is(":radio") || element.is(":checkbox")) {
element.closest('.option-group').after(error);
} else {
error.insertAfter(element.parent());
}
}

}); 

}); 

</script>
{/sourcerer}
Was it helpful?

Solution

Check your javascript path, is it really located on home/matedis/public_html/ on the server?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top