我有2个不同的xhtml页面。第一个内容与第二个内容类似,但是当我提交页面时,第二个代码中的电子邮件输入除了任何值外都没有,并显示“请匹配请求的格式”。这可能是什么问题?
first.xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<link rel="stylesheet" href="css/info_page.css" type="text/css" media="all" />
<script type="text/javascript">
function validateForm()
{
var x=document.forms["res_sign_up"]["password1"].value;
var y=document.forms["res_sign_up"]["password2"].value;
if ( x != y )
{
alert("Sifreleriniz ayni olmalidir.");
return false;
}
}
</script>
<title></title>
</head>
<body>
<script type="text/JavaScript" src="css/custom.js"></script>
<form name="res_sign_up" action="cgi-bin/res_edit_profile.py" onsubmit="return validateForm()"
method="POST">
<div id="baslik"> <img src="css/images/profil_duzenle_baslik.png" id="img1" />
<a href="http://twitter.com/me" class="img2" title="T"></a> </div>
<br />
E-mail adresi:
<p><input type="email" class="text1" name="email" required="required" /></p>
<p>Şifre:</p>
<p><input type="password" class="text1" name="password1" required="required" /></p>
<p>Şifre (tekrar):</p>
<p><input type="password" class="text1" name="password2" required="required" /></p>
<p>Restoran Adı:</p>
<p><input type="text" class="text1" name="isim" required="required" /></p>
<p>Telefon No:</p>
<p><input type="tel" class="text1" name="telno" maxlength="10" required="required" /></p>
<p>İl:</p>
<p><input type="text" class="text1" name="il" required="required" /></p>
<p>İlçe:</p>
<p><input type="text" class="text1" name="ilce" required="required" /></p>
<p>Semt:</p>
<p><input type="text" class="text1" name="semt" required="required" /></p>
<p>Tam Adres:</p>
<p><input type="text" class="text1" name="tamadres" required="required" /></p>
<p>Restoran Türü:</p>
<p>
<select name="tur" required="required" class="list">
<option value="cafe">Cafe</option>
<option value="cinmutfak">Çin Mutfağı</option>
<option value="deniz">Deniz Ürünler</option>
<option value="dunya">Dünya Mutfağı</option>
<option value="ev">Ev Yemekleri</option>
<option value="fastfood">Fast Food</option>
<option value="gurme">Gurme</option>
<option value="italyan">İtalyan Mutfağı</option>
<option value="japon">Japon Mutfağı</option>
<option value="kebapturk">Kebap ve Türk Mutfağı</option>
<option value="kofte">Köfte</option>
<option value="pasta">Pasta ve Tatlı</option>
<option value="pide">Pide</option>
<option value="pizza">Pizza</option>
</select>
</p>
<p>Çalışma Saatleri:</p>
<p>Pazartesi: <input type="text" class="text1" name="saatler1" value="09:00-22.30"
required="required" /></p>
<p> Salı: <input type="text" class="text1" name="saatler2" value="09:00-22.30"
required="required" /></p>
<p> Çarşamba:<input type="text" class="text1" name="saatler3" value="09:00-22.30"
required="required" /></p>
<p> Perşembe: <input type="text" class="text1" name="saatler4" value="09:00-22.30"
required="required" /></p>
<p> Cuma: <input type="text" class="text1" name="saatler5" value="09:00-22.30" /></p>
<p> Cumartesi:<input type="text" class="text1" name="saatler6" value="11:00-22.00"
required="required" /></p>
<p> Pazar: <input type="text" class="text1" name="saatler7" value="-"
required="required" /></p>
<p>Rezervasyon Durumu:</p>
<p>
<select name="rezervasyon" required="required" class="list">
<option value="hici">Hafta içi yapılabilir.</option>
<option value="hsonu">Hafta sonu yapılabilir.</option>
<option value="htum">Hafta içi ve hafta sonu yapılabilir.</option>
<option value="yapma">Yapılamaz</option>
</select>
</p>
<p>Ödeme Seçenekleri:</p>
<input type="checkbox" class="styled" name="payment" value="Nakit" />Nakit<br />
<input type="checkbox" class="styled" name="payment" value="Kredi Karti" />Kredi
Kartı<br />
<input type="checkbox" class="styled" name="payment" value="SmarTicket" />SmarTicket<br />
<input type="checkbox" class="styled" name="payment" value="Ticket Yemek Ceki" />Ticket
Yemek Çeki<br />
<input type="checkbox" class="styled" name="payment" value="PassCard" />PassCard<br />
<input type="checkbox" class="styled" name="payment" value="Sodexho Yemek Ceki" />Sodexho
Yemek Çeki<br />
<input type="checkbox" class="styled" name="payment" value="Multinet" />Multinet<br />
<input type="checkbox" class="styled" name="payment" value="SetCard" />SetCard<br />
<input type="checkbox" class="styled" name="payment" value="Winwin Yemek Ceki" />Winwin
Yemek Çeki
<p><a href="history.go%28-1%29;return%20true;" class="back" title="T"></a><input
type="image" class="onay1" formmethod="post" name="myclicker" value="" /></p>
</form>
</body>
</html>
second.xhtml(不提交任何值):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>login_page</title>
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<link rel="stylesheet" href="css/login_page.css" type="text/css" media="all" />
</head>
<body>
<script type="text/JavaScript" src="css/custom.js"></script>
<form name="res_sign_up" action="cgi-bin/login_check.py"
method="POST"><img src="css/images/hosgeldiniz.png" /> <img src="css/images/logo.png" />
<input type="email" pattern="E-mail Adresi" class="login1" name="email" required="required" />
<input type="password" class="login1" name="password" required="required" />
<img class="login4" alt="remember" src="css/images/beni_hatirla.png" /> <input
type="checkbox" class="styled" name="remember" /> <a href="http://twitter.com/me"
class="login3" title="T"></a> <input type="image" class="login5" formmethod="post"
name="myclicker" value="" /> <a href="http://twitter.com/me" class="login6"
title="T"></a> </form>
</body>
</html>
答案 0 :(得分:3)
在第二种形式中,您有以下内容:
<input type="email" pattern="E-mail Adresi" class="login1" name="email" required="required" />
您添加了pattern="E-mail Adresi"
,这意味着输入必须与该正则表达式匹配。并且没有有效的电子邮件地址将与正则表达式“E-mail Adresi”匹配。我怀疑您想使用placeholder="E-mail Adresi"
添加提示文本。