Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Tuesday, 13 February 2018

Validate File Size Spell Upload Amongst The Help Of Javascript

Validate File Size Spell Upload Amongst The Help Of Javascript

This ship service shows how to validate the file spell upload the data. While uploading the information it checks the validation similar the file size should move less too then 2MB too you lot too validate  the format of the file. Here i checking the file size should move less too then 2MB. If the size should move to a greater extent than than 2mb it shows the mistake "File size is grater than 2mb.Please upload the file below 2mb." Like that.

This is the script to validate the file spell upload:

<script>
business office validate() {
$("#file_error").html("");
$(".inputbox1").css("border-color","#F0F0F0");
var file_size = $('#file')[0].files[0].size;
if(file_size>2097152) {
$("#file_error").html("File size is greater than 2MB. Please upload file below 2MB.");
$(".inputbox1").css("border-color","#FF0000");
supply false;
supply true;
}
</script>

It showing crimson edge inward the text box too given the mistake message below the text box  when validation mistake occurs. Please Check the demo page to banking company friction match this example. This is i of the really useful concept for the programmers. I promise this is really useful.

Code for Validate File on Upload:

<html>
<head>
<style>
#filesizeval {width:500px; margin:0 auto;    border: #050505 2px solid;
background: #F1F0F0;padding:80px; }
.inputbox1{
padding:10px;    
margin: 0 auto;display: 
block;     
border: 1px company #A39F9F; 
border-radius:4px;
background-color:#FFF;
}
#file_error
{
color: #FF0000;
}
#button
{
background-color:#2FC332;
margin: 23px auto;
display: block; 
border:0;
padding:10px 40px; 
color:#FFF;
border:#F0F0F0 1px solid; 
border-radius:4px;
}
</style>
<script src="http://code.jquery.com/jquery-2.1.1.js"></script>
<script>
business office validate() {
$("#file_error").html("");
$(".inputbox1").css("border-color","#F0F0F0");
var file_size = $('#file')[0].files[0].size;
if(file_size>2097152) {
$("#file_error").html("File size is greater than 2MB. Please upload file below 2MB.");
$(".inputbox1").css("border-color","#FF0000");
supply false;
supply true;
}
</script>
</head>
<body>
<form name="filesizeval" id="filesizeval" method="post" action=""  onSubmit="return validate();">
<div><input type="file" name="file" id="file" class="inputbox1" /> <br/><center><span id="file_error"></span></center></div>
<div><input type="submit" id="button" value="Upload"/></div><br/><br/>
<center><a style="color: #000; font-weight: bold; font-size: 17px;" href="http://www.sanwebcorner.com">www.sanwebcorner.com</a></center>
</form>
</body>
</html>

Monday, 12 February 2018

Test Your Password Line Using Jquery

Test Your Password Line Using Jquery

To present the password forcefulness to the client is i of the of import concept, because the user volition know  how rigid our password in addition to it helps to reset the password when the password is poor. The password is i of the real of import plain to access their profile in addition to then the password should last rigid in addition to then nosotros involve to gear upwardly the rigid password. In the below event accept the 2 dissimilar forcefulness validation. 

In the showtime event the forcefulness meter is inwards below text box it shows how the password strength. It changes the blood-red coloring when password is piteous in addition to also display the text similar your password is likewise weak.when password is 4 to 8 grapheme it shows the message "Could last stronger" in addition to coloring is yellow. And the password is to a higher house 8 grapheme it shows "password is strong" message in addition to coloring changes equally green.

In the minute event same text volition display similar the to a higher house event but at that topographic point is no forcefulness meter inwards this instead of this meter it changes the edge coloring of the password text plain dynamically based on the password strength 

Here i did the validation using grapheme you lot tin sack gear upwardly the password validation using combination of the characters in addition to the numbers in addition to exceptional characters past times changing the script validation. Check the below event demo page to meet the similar demo of the below example. I promise this concept is real useful. 


Code for attempt out Password strength:

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Password forcefulness Indicator using Jquery</title>
<link href="https://fonts.googleapis.com/css?family=PT+Sans+Narrow" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Password forcefulness Validation Option1:</h1>
<div class="form-container">
<form class="form-1" action="">
<label>Enter password</label>
<input class="input-1" type="password" placeholder="&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;">
<div class="progress-bar_wrap">
<div class="progress-bar_item progress-bar_item-1"></div>
<div class="progress-bar_item progress-bar_item-2"></div>
<div class="progress-bar_item progress-bar_item-3"></div>
</div>
<span class="progress-bar_text">Password is blank</span>
</form>
</div>
<h1>Password forcefulness Validation Option2:</h1>
<div class="form-container">
<form class="form-4" action="">
<label>Enter password</label>
<input class="input-4" type="password" placeholder="&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;">
<span class="progress-bar_text">Password is blank</span>
</form>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script  src="js/index.js"></script>
</body>
</html>

Sunday, 11 February 2018

Simple Countdown Based On Engagement Using Javascript

Simple Countdown Based On Engagement Using Javascript

This Post assistance y'all how to produce countdown based on your given date. It automatically takes the countdown using engagement y'all are provided. It displays the years, months, days, hours, minutes together with seconds. It is really useful display the counter for the lawsuit launching together with whatever other novel production launching system.This countdown display amongst animation countdown cube.If y'all don't desire display about fields similar years thus y'all should withdraw the fields inward JavaScript. You tin strength out able to alter the fourth dimension zone inward the below javscript code i am using here Asia/Kolkata the default fourth dimension zone is UTC, It volition convert the utc to Asia/Kolkata. This concept is laid amongst given terminate time, It automatically calculated the years, months, days, hours, minutes, seconds together with display the results inward the cube div.



The below html code is used to display the amount countdown
<div id='counter' class='counter'></div>
And the countdowncube.css file used blueprint the counter boxes inward a perfect mode y'all tin strength out able to alter the styles together with colors according to your alternative to edit the countdowncube.css file. together with the countdowncube.js have the javascripts to display the counter y'all tin strength out edit together with customize the counters according to your choice.

I promise this uncomplicated concept is really useful to you. This lawsuit produce got the exhibit page delight cheque out the exhibit page together with download the amount code together with utilisation it to your website.

Countdown based on given date:

<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Simple Countdown based on Date using Jquery</title>
<meta name="description" content="Personal Website of Ali Cigari, jack of all trades...">
<meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<link rel="stylesheet" href="countdowncube.css">
<style class="inlinestyle">
.counter {
margin: 10 auto;
text-align: center;
}
body
{
background-color: rebeccapurple;
}
</style>
</head>
<body>
<div id='counter' class='counter'></div>

<script src="countdowncube.js"></script>
<script>
var targetDate = novel Date();
targetDate.setMonth(targetDate.getMonth() + 18)
targetDate.setDate(1)
targetDate.setHours(11)
targetDate.setMinutes(0)
targetDate.setSeconds(0)
targetDate.setMilliseconds(0);

var targetDateStringUTC = targetDate.toISOString()
.replace(':00.000', '');
var targetDateString = targetDateStringUTC.replace('Z', '');

var targetLADate = moment.tz(targetDateStringUTC,
'Asia/Kolkata').format();
var tzLAOffset = targetLADate.substr(-6);
var targetDateStringOffset = targetDateString.replace('Z', '')
.replace(':00.000', '') +
tzLAOffset;

var tzOldFormatOffset = targetDateString.substr(-5);
var targetDateOldFormatString = targetDate.toLocaleDateString() +
' ' + tzOldFormatOffset;

var pastDate = novel Date();
pastDate.setMonth(targetDate.getMonth() - 18)
pastDate.setMinutes(0);
pastDate.setSeconds(0);
pastDate.setMilliseconds(0);
var targetDateStringPast = pastDate.toISOString()
.replace(':00.000', '');
var nearFutureDate = novel Date();
nearFutureDate.setSeconds(nearFutureDate.getSeconds() + 10);
nearFutureDate.setMilliseconds(0);
var nearFutureDateString = nearFutureDate.toISOString()
component subdivision reloadCounter(element_id,
new_target,
targetTimezone,
cubeSize,
background,
color,
onEnd,
triggerEnd) {

$(element_id).empty();

$(element_id).countdownCube( {
target: new_target,
targetTimezone: targetTimezone,
cubeSize: cubeSize,
background:  background,
color: color,
onEnd: onEnd,
triggerEnd: triggerEnd,
} );
};
</script>
<script>
$('#counter').countdownCube( {
target: targetDateStringUTC,
cubeSize: 150,
background:  '#ffff00',
color: 'blue',
} );

$('#counter-end-notrigger').countdownCube( {
target: targetDateStringPast,
targetTimezone: 'UTC',
cubeSize: 150,
background:  'lightcyan',
color: 'darkcyan',
/*
target is inward the by together with triggerEnd is false,
thus onEnd is non triggered when the page is loaded
*/
onEnd: function(e) {
$("#counter-end-notrigger")
.text('This was the end, but it was non triggered! ' +
'(counter master copy target: ' +
e.options.targetDateObject.toISOString() +
')');
}
} );
$('#counter-end-trigger').countdownCube( {
target: targetDateStringPast,
targetTimezone: 'UTC',
cubeSize: 150,
background:  'lightcyan',
color: 'cyan',
onEnd: function(e) {
$("#counter-end-trigger")
.text('This was the terminate together with it was triggered! ' +
'(counter master copy target: ' +
e.options.targetDateObject.toISOString() +
')');
},
triggerEnd: true,
} );

$('#counter').countdownCube({
target: novel Date( 'Feb 10, 2018 7:47:00' ),
cubeSize: 50
});
</script>
</body>
</html>

Saturday, 10 February 2018

How To Practice 3(Three) Footstep Registration Course Of Pedagogy Alongside Javascript Validation

How To Practice 3(Three) Footstep Registration Course Of Pedagogy Alongside Javascript Validation

This post helps y'all how to practice uncomplicated too perfect 3 measurement shape alongside Javscript validation using Css3 too Html.Now a days 3 measurement shape is normally used shape inward the webpages because it is real attractive i for the customers because it helps no need to scroll downwards for the bigger type forms. And too 3 measurement shape is captured the information yesteryear the categories, And too this from contains the Progress bar inward the top of the shape it volition done yesteryear using css3 too Jquery for user reference.

This uncomplicated attractive shape volition done yesteryear using css3 too html too validation purpose nosotros used the JavaScript. The shape is processed the validation measurement yesteryear measurement yesteryear clicking the adjacent button. Here convey a in conclusion measurement to verify the all of your shape contents alongside your data. You tin move customize this shape according to your project. I promise this tutorial  is real useful for the developers.


In this event i used the name, electronic mail too province inward the get-go measurement if y'all clicked adjacent push clit without whatsoever information y'all volition teach the validation fault similar the below screenshot.In the adjacent measurement is username too password too confirmation password is given alongside JavaScript validation, the tertiary measurement is verification measurement is to display all your Datas from the form.

This multiple measurement shape is the responsive shape it volition tally all the device because its done yesteryear using bootstrap too html . This multi measurement shape is used to cut down the webpage infinite equally good the user attraction. The below event convey the codes too demo page. Check the below demo page for your ameliorate agreement of this Three(3) Level shape alongside validation.

 This post helps y'all how to practice uncomplicated too perfect  How to practice 3(three) measurement registration shape alongside JavaScript validation


Html Code Three measurement shape alongside Validation:

<div class="container">
<br><br>
<form class="form-horizontal form">
<div class="col-md-8 col-md-offset-2">  
<div class="progress">
<div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div>
</div>

<div class="box row-fluid">
<br>
<div class="step">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" name="name" class="form-control" id="name" placeholder="Name">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="text" name="email" class="form-control" id="email" placeholder="email">
</div>
</div>
<div class="form-group">
<label for="country" class="col-sm-2 control-label">Country</label>
<div class="col-sm-10">
<select class="form-control" name="country" id="country">
<option value="">Select</option>
<option value="India">India</option>
<option value="Australia">Australia</option>
<option value="USA">USA</option>
<option value="Japan">Japan</option>
<option value="Singapore">Singapore</option>
<option value="Malaysia">Malaysia</option>
</select>
</div>
</div>
</div>
<div class="step">
<div class="form-group">
<label for="username" class="col-sm-2 control-label">Username</label>
<div class="col-sm-10">
<input type="text" name="username" value="" class="form-control" id="username" placeholder="Username">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input type="password" name="password" value="" class="form-control" id="password" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="rpassword" class="col-sm-2 control-label">Retype Password</label>
<div class="col-sm-10">
<input type="password" name="rpassword" class="form-control" id="rpassword" placeholder="Retype password">
</div>
</div>  
</div>
<div class="step display">
<h4>Confirm Details</h4>
<div class="form-group">
<label class="col-sm-2 control-label">Name :</label>
<label class="col-md-10 control-label lbl" data-id="name"></label>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Email :</label>
<label class="col-md-10 control-label lbl" data-id="email"></label>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Country :</label>
<label class="col-md-10 control-label lbl" data-id="country"></label>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Username :</label>
<label class="col-md-10 control-label lbl" data-id="username"></label>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Password :</label>
<label class="col-md-10 control-label lbl" data-id="password"></label>
</div>
</div>

<div class="row">
<div class="col-sm-12">
<div class="pull-right">
<button type="button" class="action btn-sky text-capitalize dorsum btn">Back</button>
<button type="button" class="action btn-sky text-capitalize adjacent btn">Next</button>
<button type="button" class="action btn-hot text-capitalize submit btn">Submit</button>
</div>
</div>
</div>

</div>
<a style="color:#fff; float:right;" href="http://www.publishertrend.com/"><h3>www.sanwebcorner.com</h3></a>
</div>
</form>
</div>

Javascript for 3 measurement shape alongside validation:

<script type="text/javascript">
$(document).ready(function(){
var electrical current = 1;

widget      = $(".step");
btnnext     = $(".next");
btnback     = $(".back"); 
btnsubmit   = $(".submit");

// Init buttons too UI
widget.not(':eq(0)').hide();
hideButtons(current);
setProgress(current);

// Next push clit click action
btnnext.click(function(){
if(current < widget.length){
// Check validation
if($(".form").valid()){
widget.show();
widget.not(':eq('+(current++)+')').hide();
setProgress(current);
}
}
hideButtons(current);
})

// Submit push clit click
btnsubmit.click(function(){
alert("Submit push clit clicked");
});


// Back push clit click action
btnback.click(function(){
if(current > 1){
electrical current = electrical current - 2;
if(current < widget.length){
widget.show();
widget.not(':eq('+(current++)+')').hide();
setProgress(current);
}
}
hideButtons(current);
})

$('.form').validate({ // initialize plugin
ignore:":not(:visible)",
rules: {
mention     : "required",
electronic mail    : {required : true, email:true},
province  : "required",
username : "required",
password : "required",
rpassword: { required : true, equalTo: "#password"},
},
});

});

// Change progress bar action
setProgress = function(currstep){
var per centum = parseFloat(100 / widget.length) * currstep;
per centum = percent.toFixed();
$(".progress-bar").css("width",percent+"%").html(percent+"%");
}

// Hide buttons according to the electrical current step
hideButtons = function(current){
var bound = parseInt(widget.length); 

$(".action").hide();

if(current < limit) btnnext.show();
if(current > 1) btnback.show();
if (current == limit) { 
// Show entered values
$(".display label.lbl").each(function(){
$(this).html($("#"+$(this).data("id")).val());
});
btnnext.hide(); 
btnsubmit.show();
}
}
</script>