Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-18-2009, 10:59 PM   PM User | #1
rushhh
New Coder

 
Join Date: Sep 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
rushhh is an unknown quantity at this point
ajaxFileUpload with jQuery Form validation input text help

Hi, For the last few days been tring to design jQuery Form validation text box with ajax upload

Basic I'm trying to input text in a text box and upload a file. On the back end file it check the database to see if Lastname has already been enter, If the username hasn't been add, it then insert to the the datebase with the new username and uploads the image as well.

[CODE]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script type="text/javascript" src="http://www.phpletter.com/contents/ajaxfileupload/ajaxfileupload.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({

//errorLabelContainer: "#messageBox",
//wrapper: "li",
rules: {
username : {
required: true,
minlength: 5,
remote: {
url: "test13.php",
type: "post",
data: {
type: "text",
username : function() { return $("#username ").val()},
}
}

}

},
messages: {
username : {
required: "Please provide a username",
minlength: "Your username must be at least 5 characters long",
remote: jQuery.format("Sorry but '{0}' has already been selected. Please try again.")
}
},
submitHandler: function(form) {
$.ajaxFileUpload
(
{
url:'test13.php',
secureuri:false,
fileElementId:'fileToUpload',
dataType: 'json''


}
)
return false;
}
});

});
</script>

</head>
<body>
<ul id="messageBox"></ul>

<form id="myform" action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="fileframe" value="true">
<label> username </label>
<input name="lname" id="username " title="Your username , please!" class="required" />
<br/>
<input type="file" name="fileToUpload" id="fileToUpload" class="input">
<br />
<input type="submit" value="Submit"/>
</form>

</body>
</html>
[CODE]

Thanks
rushhh is offline   Reply With Quote
Old 10-19-2009, 05:11 PM   PM User | #2
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
What does the code above do? Is it online anywhere we can see it?
Spudhead is offline   Reply With Quote
Old 10-20-2009, 04:30 AM   PM User | #3
rushhh
New Coder

 
Join Date: Sep 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
rushhh is an unknown quantity at this point
Never mind, I fingered it out another way.
rushhh is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:30 AM.


Advertisement
Log in to turn off these ads.