提交时如何弹出(如果可能,不刷新页面)? [英] How to make pop up when submit (not refresh page if possible) ?
问题描述
我试着用ketchup.js和表格工作制作提交表格..现在我不知道如何在提交值错误时弹出窗口...
这是我的submit.php表格:
< html>
< head>
< script src = ../ js / jquery.ketchup.messages.js > < / script >
< script src = ../ js / jquery.ketchup.validations.basic.js > < / script >
< body >
< 表格 action = ../include/example.php class < span class =code-keyword> = add_user 方法 = 发布 enctype = mul tipart / form-data >
< 表格 >
< tr >
< td > < label for = 用户名 > 用户名< / label > < / td >
< td > < 输入 type = text id = username 类 = 验证(必填) / > < / td >
< / tr & gt;
< tr >
< td > < label = email1 > 电子邮件< / label > < / td >
< td > < input type = text id = email1 class = 验证(必填) / > < < span class =code-leadattribute> / td >
< / tr >
< tr >
< td > < label for = email2 > 确认电子邮件< / label > < / td >
< td > < input 类型 = text id = email2 class = 验证(必填,匹配(#email1)) / > < / td > ;
< / tr >
< / table >
< div class = 提交 >
< input type = 提交 value = 提交 / >
< / form >
< < span class =code-leadattribute> / body >
我想得到$ _POST [''email2'']作为弹出错误的触发器,但我无法弄清楚如何...我尝试使用Jquery对话框但是不行。
我试着制作这个简单的代码,看看我的方法是否能获得$ _POST [''email2'']值是对的但页面没有显示任何内容,也没有错误..这是我提交按钮时的代码
< ?php
if (isset($ _ POST [' email2'])){
echo 电子邮件地址无效;
}
?>
任何人都可以帮我看看我错在哪里请...
感谢Sergey Alexandrovich Kryukov现在我可以弹出.dialog()出现在我按提交按钮
我添加这样的HTML
< < span class =code-leadattribute> script >
$(document).ready(function(){
$ ('.submit')。click(function(){
$('。pop_up')。dialog({
resizable:false,
draggable:false,
height: 110,
宽度:300,
位置:右下角,
});
});
});
< / script >
< div class = pop_up title = 电子邮件无效 >
< p > 再次输入您的电子邮件< / p >
< img src = ../ images / peringatan.png style = float:left;位置:相对;顶部:-17px; left:-5px; / > ;
< / div >
但div中的文字出现在邮件页面中..如何才能使这个文字出现在.dialog()中弹出?
如果我尝试使用css display-property {display:none},则文本不会出现在main中或弹出...
_POST [''email2'']作为弹出错误的触发器,但我无法弄清楚如何..我尝试过Jquery对话但是不起作用。
我试着制作这个简单的代码,看看我的方法是否得到
< blockquote> _POST [''email2'']值是对的,但页面没有显示任何内容,也没有错误..这是我提交按钮时的代码
<前拉ng =cs> < ?php
if (isset(
_POST [' email2'])){
echo 电子邮件地址无效;
}
?>
任何人都可以帮我看看我错在哪里请...
感谢Sergey Alexandrovich Kryukov现在我可以弹出.dialog()出现在我按提交按钮
我添加这样的HTML
< < span class =code-leadattribute> script >
Hi, I tried to make a submit form with ketchup.js and the form work.. and now I don''t now how to make a pop up appear when the submit value error...
this is my submit.php form :
<html>
<head>
<script src="../js/jquery.ketchup.messages.js"></script>
<script src="../js/jquery.ketchup.validations.basic.js"></script>
<body>
<form action="../include/example.php" class="add_user" method="post" enctype="multipart/form-data">
<table>
<tr>
<td><label for="username">username</label></td>
<td><input type="text" id="username" class="validate(required)" /></td>
</tr>
<tr>
<td><label for="email1">Email</label></td>
<td><input type="text" id="email1" class="validate(required)" /></td>
</tr>
<tr>
<td><label for="email2">Confirm Email</label></td>
<td><input type="text" id="email2" class="validate(required, match(#email1))"/></td>
</tr>
</table>
<div class="submit">
<input type="submit" value="Submit" />
</form>
</body>
I want to get the $_POST[''email2''] as a trigger to the pop up error but I cannot figure out how..I tried with Jquery dialog but doesn''t work.
And I tried to make this simple code to see if my method to get the $_POST[''email2''] value is right but the page don''t show anything and no error..this is my code when the submit button press
<?php
if(isset($_POST['email2'])) {
echo "Email Address Not Valid";
}
?>
Can anyone help me show where I was wrong please...
Thanks to Sergey Alexandrovich Kryukov Now i can make the pop up .dialog() appear when I press submit button
I add html like this
<script>
$(document).ready(function() {
$('.submit').click(function () {
$('.pop_up').dialog({
resizable: false,
draggable: false,
height:110,
width:300,
position: "right bottom",
});
});
});
</script>
<div class="pop_up" title="Email Not Valid">
<p>Type Your Email Again</p>
<img src="../images/peringatan.png" style="float: left; position: relative; top:-17px; left:-5px;" />
</div>
But the text inside div appear in mail page to..How can I make this text only appear in .dialog() pop up?
If I tried to use css display-property {display:none}, the text won''t show up both in main or pop up...
_POST[''email2''] as a trigger to the pop up error but I cannot figure out how..I tried with Jquery dialog but doesn''t work.
And I tried to make this simple code to see if my method to get the
_POST[''email2''] value is right but the page don''t show anything and no error..this is my code when the submit button press
<?php if(isset(
_POST['email2'])) { echo "Email Address Not Valid"; } ?>
Can anyone help me show where I was wrong please...
Thanks to Sergey Alexandrovich Kryukov Now i can make the pop up .dialog() appear when I press submit button
I add html like this
<script>
这篇关于提交时如何弹出(如果可能,不刷新页面)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!