单击忘记密码链接,它将显示所需的错误消息电子邮件字段

时间:2017-03-16 06:02:56

标签: codeigniter

如果我点击忘记密码链接,我想显示错误消息,它会显示错误消息所需的电子邮件字段。this is the forgot password page images

<form action="<?php echo base_url(); ?>Index.php/Login_cntrl/login" method="POST" >

                        <div class="field-wrap">
                            <label class="view-label">Email Address</label>
                            <input type="email" placeholder="Email Address" name="email" id="email" class="input-control" value="<?php echo set_value('email'); ?>"/>
                            <span class="text-danger"><?php echo form_error('email'); ?></span>
                        </div>

                        <div class="field-wrap">
                            <input type="password" placeholder="Password" name="password" id="password" value="<?php echo set_value('password'); ?>" />
                            <span class="text-danger"><?php echo form_error('password'); ?></span>

                            <a href="javascript:void(0)" class="btn btn-link btn-nobg" id="btn-show-forgot" >Forgot ?</a>  

                        </div>


                        <div class="field-wrap">
                            <button type="submit" class="btn btn-submit" name="ulogin" id="ulogin" >Login</button>
                        </div>
                        <div class="field-wrap">
                            <a href="javascript:void(0)" class="btn btn-link btn-nobg" id="btn-show-signup">NEW User? Sign up</a>
                        </div>
                    </form>

2 个答案:

答案 0 :(得分:0)

如果你像这样使用jQuery

$('#btn-show-forgot').click(function(event) {
/* Check Email Value */
var email = $('#email').val();
if (email == ''){
alert('email must not empty')}
});

或尝试这样

$(document).on('click','#btn-show-forgot',function(event){
var email = $('#email').val();
if (email == ''){
alert('email must not empty')}
});

答案 1 :(得分:0)

根据需要尝试这个

$('#btn-show-forgot').click(function(event) {
var email = $('#email').val();
if (email == ''){
var r = confirm("Press a button!");
if (r == true) {
window.location = //your landing page
} else {
txt = "You pressed Cancel!";
}
}
});`