in a my page i have create che code for a modal dialog box in jquery:
<script type="text/javascript">
$(document).ready(function() {
$('#dialog').dialog({
autoOpen: false,
height: 280,
modal: true,
resizable: false,
buttons: {
OK: function() {
$(this).dialog('close');
}
}
});
});
</script>
i should want the window appears if a condition isn't found in a PHP page, for example
if ($user->username) {
if ($user->password1) {
if ($user->password2) {
if ($user->password1 == $user->password2)
$user->save();
else
echo $user->message("password aren't equals!");
} else
echo $user->message("password 2 isn't inserted!");
} else
echo $user->message("password 1 isn't inserted!");
} else
echo $user->message("username isn't present!");
where MESSAGE is a public function like this:
public function message($text) {
$script = "<div id=\"dialog\" title=\"warning\">" . $text . "</div>";
$script = "<script type=\"text/javascript\">$('#dialog').dialog('open')</script>";
return $script;
}
but this code doesn't work..why? i should open the box only with a click event for example?