Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#add_entry_dialog").dialog({
- width: 460,
- draggable: true,
- modal: true,
- bgiframe: true, //for ie bugS
- autoOpen: false,
- resizable: false,
- buttons: {
- 'Ok': function() {
- var datas = [];
- //prepare the data for ajaxing to modelview.php
- $(':input', this).each(function() {
- datas.push(this.name + '=' + escape(this.value));
- })
- $.ajax({
- type: "POST",
- url: "modelview.php",
- data: "action=add&" + datas.join('&'),
- beforeSend: function() {
- $("#box_ajax_gui > .ajax_gui").hide();
- },
- error: function() {
- alert("An error occured");
- },
- success: function() {
- fetch();
- }
- });
- //CLEAR THE FORM - need work (i don't want to use jquery.form)
- //validator.resetForm();
- $(':input', this).each(function() {
- this.value = '';
- })
- $(':select', this).each(function() {
- this.selectedIndex = 0;
- })
- if(validator) {
- alert('ok');
- } else {
- alert('nope');
- }
- alert(wow);
- $(this).dialog('close');
- },
- Cancel: function() {
- $(this).dialog('close');
- }
- }
- });
- var validator = $("#add_form").validate({
- rules: {
- user_username: {
- required: true,
- minlength: 4,
- //remote: "customphpcheck.php"
- },
- user_password: {
- required: true,
- minlength: 5,
- },
- user_email: {
- required: true,
- email: true,
- //remote: "customphpcheck.php"
- }
- },
- messages: {
- user_username: {
- required: "Enter a User Name",
- minlength: jQuery.format("Enter at least {0} characters"),
- },
- user_password: {
- required: "Enter a password",
- minlength: jQuery.format("Enter at least {0} characters")
- },
- user_email: {
- required: "Please Enter an Email Address",
- }
- },
- errorLabelContainer: $("ul", "#add_form .error"),
- wrapper: 'li',
- });
Add Comment
Please, Sign In to add comment