10-09-2013, 09:50 AM
[eluser]Nidheesh[/eluser]
Hello In my Blog Form i have inserted jquery but it is not catching the form validation .data insertion is functioning properly.here is my Code snapshots
View Code
Folder Structure is also attached..
Hello In my Blog Form i have inserted jquery but it is not catching the form validation .data insertion is functioning properly.here is my Code snapshots
View Code
Code:
<!DOCTYPE HTML>
<head>
<meta http-equiv="content-type" c />
<meta name="author" c />
<title>Title</title>
<?=site_url() ?>
</head>
[removed][removed]
[removed]
$(document).ready(function(){
$('#Submit').click(function(){
$('#addblog').Submit();
return false;
})
})
[removed]
[removed]
jQuery(document).ready(function() {
// validate signup form on keyup and submit
jQuery("#addblog").validate({
rules: {
blog_title: {
required: true
},
blog_content: {
required: true
}
},
messages: {
blog_title:{
required: "Please enter the title"
},
blog_content : "Please enter Content"
},
submitHandler: function(form) {
jQuery(form).ajaxSubmit({
target: "#result1",
resetForm: "true",
success: function(data) {
//jQuery('#saleUserId').val('');
},
debug:true
});
}
});
});
[removed]
<body>
<h1>Add New Blog</h1>
<li><a href="<?=site_url()?>">Click Here</a></li>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
<fieldset><legend>Add New Blog</legend>
<form acti method="post" name="SaveBlog" id="addblog">
<table width="58%" height="138" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="47%" height="19" class="cont" align="center"> </td>
<td width="53%"> <div id="result" ></div></td>
</tr>
<tr>
<td height="19" align="left" class="cont">Enter Blog Title</td>
<td align="left"><input type="text" name="blog_title" id="blog_title" /></td>
</tr>
<tr>
<td height="19" align="left" class="cont">Enter Blog Content</td>
<td align="left"><textarea name="blog_content" cols="50" rows="20" id="blog_content" ></textarea></td>
</tr>
<tr>
<td height="43" colspan="2" align="center"><input type="submit" name="button" id="button" value="Submit"/></td>
</tr>
<tr>
<td height="19" colspan="2" align="left"> </td>
</tr>
</table>
</fieldset>
</form>
<h1>Data From Database through M and C</h1>
<h3>Current Blogs on the Screen</h3>
<?
if(isset($Page_Data) && is_array($Page_Data))
{
foreach($Page_Data as $key => $val)
{
$key = $val;
}
}
?>
<?
//print_r($Page_Data);
foreach($Page_Data as $row)
{
?>
<div>
<span>
<table>
<tr>
<td blueviolet;">Title</td>
<td red;"><?echo $row->title;?></td>
</tr>
<tr>
<td blueviolet;">Content</td>
<td red;"><?echo $row->content;?></td>
</tr>
</table>
</div>
<div>
</span>
</div>
<?}
?>http://localhost:8088/samplesite/index.php/Blog/
</body>
</html>
Folder Structure is also attached..