Location: PHPKode > projects > SimpleHRM > simplehrm-1.0-beta1/simplehrm-1.0-beta1/templates/default/admin/user/profile.tpl.html
{assign var=x value=$sm.userdata}
<div class="box box-75 altbox">
    <div class="boxin">
        <div class="header">
        	<h3>Profile</h3>
        </div>
	<form class="basic" action="##LBL_ADMIN_SITE_URL##index.php/page-user-choice-update_profile" method="post" name="profile_form" id="profile_form">       
     <div class="inner-form">
	 <div id="show_err">{if $sm.fail_msg}{$sm.fail_msg}{/if}</div>
            <dl>
                <dt class="t1"><label for="some1">Email id:</label></dt>
                
                <dd>
                     <input type="text" id="email" name="email" class="txt" value="{$x.email_id}" onblur="check_email('a');"/>
                </dd>
               <!--
                <dt class="t1"><label for="some1">Username:</label></dt>
                
                <dd>
                     <input type="text" id="uname" name="uname" class="txt" value="{$x.username}" onblur="check_uname('a');"/>
                </dd>
                -->
                <dt class="t1"><label for="some1">Old Password:</label></dt>
                
                <dd>
                    <input type="password" id="opass" name="opass" class="txt"/>
                </dd>
                <dt class="t1"><label for="some1">New Password:</label></dt>
                
                <dd>
                     <input type="password" id="npass" name="npass" class="txt"/>
                </dd>
                <dt class="t1"><label for="some1">Confirm Password:</label></dt>
                
                <dd>
                    <input type="password" id="cpass" name="cpass" class="txt"/>
                </dd>
                <dt></dt>
                <dd>
                    <input class="button" type="button" value="Update" onclick="return validate();"/>
                    <input class="button" type="reset"/>
                </dd>
            </dl>          
        </div>
        <input type="hidden" id="oldpass" name="oldpass" value="{$x.password}"/>
        </form>
	</div>
</div>
{literal}
<script type="text/javascript">
	function validate() {
	var validator=$("#profile_form").validate({ 
	rules: {
			
			email:{
				required:true,
				email:true
			},
			npass:{
				minlength:6
			},
			cpass:{
				minlength:6,
				equalTo:'#npass'
			}
	},
	messages: {
			
			email:{
				required:flexymsg.required,
				email:flexymsg.email
			},
			npass:{
				minlength:flexymsg.minlength
			},
			cpass:{
				minlength:flexymsg.minlength,
				equalTo:flexymsg.equalTo
			}
		}
	});
	var x=validator.form();
	
		var npass=$('#npass').val();
		//alert(npass);
		var cpass=$('#cpass').val();
		var pass=$('#opass').val();
		var oldpass=$('#oldpass').val();
		if(pass){
			if(npass){
				if(npass!=cpass){
					$('#show_err').html("Confirm Password does not match.");
					return false;
				}
			}else{
				$('#show_err').html("Provide New Password.");
					return false;			
			}
		}else{
			if(npass){
				document.getElementById('npass').value="";
				document.getElementById('cpass').value="";
				$('#show_err').html("Enter Password First.");
				return false;
			}
		}
		//x=check_uname('c');
		x=1;
		if(x) {
			$('#profile_form').submit();
		}

	}
	function check_email(x) {
		var email=$('#email').val();
		var test='{/literal}{$x.email_id}{literal}';
		if(email==test){
			$("#show_err").html('');
			return true;
		}else{
			var url="##LBL_ADMIN_SITE_URL##index.php";
			$.post(url,{"page":"user","choice":"check_email",email:email,ce:0},function(res){
				if(res==1){
					if(x=='c'){
						$('#profile_form').submit();
					}	
					$('#show_err').html("");
					return true;
				}else{
					$('#show_err').html("This Email Id already exist.");
					return false;
				}
				
			});
		}
	}
</script>
{/literal}
Return current item: SimpleHRM