I have a form that contain input fields one for domain and one for folder name. now i want to validate these two fields before submitting the form.I am using jQuery validation plugin.
how can i validate my fields on custom build rules
1) domain url will not contain http:// or / at the end
   http://google.com wrong
   google.com/     wrong
   google.com      correct
2) folder name without any "/" at the start or at the end
   foldername/ wrong
   /foldername wrong
   foldername  correct
this is the code that i am trying.
<form id="f">
    <label for="domain">Domain</label>
    <input type="text" value="subdomainname.abc.com" id="domain" name="domain" maxlength="50" size="30">
    <label for="newfolder">Folder Name </label>
    <input type="text" name="newfolder" maxlength="50" size="30" id="newfolder">
    <input type="submit" value"configure">
</form>
this is validation
$(function() {
    var v = $('#f').validate({
        rules: {
            domain: {
                required: true
                 // custome rule 
            },
            newfolder: {
                required: true,
                // custome rule
            }
        },
        messages: {
            domain: {
                required: "Enter a valid url"
            },
            newfolder:{
                required: "Folder name incorrect"
            }
        },
        submitHandler: function(form) {
            alert('submit');
         }
    });          
});
 
     
    