I am trying to display a password-reset form when certain flag is triggered. I have the following basic code working to prompt the user to change their password, if there is no password_changed_flag. Depending on the response, the user receives a message back saying ‘Yes’ or ‘No’. Here is the code:
<?php if(!$password_changed_flag){
<script type="text/javascript">
$('#ajaxShield').show();
var pw = <?php echo json_encode($this->session->userdata('password')) ?>;
$.prompt("Your auto-assigned password must be changed.", pw,
function(){
$.msg("Yes.",{header:'Yes', live:10000});
$('#ajaxShield').hide();
},
function(){
$.msg("No.",{header:'No', live:10000});
$('#ajaxShield').hide();
});
</script>
<?php } ?>
My only problem is that instead of using $.prompt and $.msg, what I really need to be doing is to display a form. This is the code the I have elsewhere which launches the form:
<a href="#ChangePW" return false; class="login-window" >Change Password</a>
I guess my problem is that I can view the form with the click of a hyperlink, but instead of viewing the form using a hyperlink, I need to be able to view the form when there is no password_changed_flag, as in the above code. So, it looks like I need to simulate the lower code block inside the upper code bock, somehow.
How can I simulate what happens in response to the hyperlink, without relying on a hyperlink?
Any ideas? Thanks.
You can trigger the click with Jquery
If your using fancybox which your markup suggests you can also use: