问题描述
我有一个注册表单设置,可以在所有浏览器上正常工作,除了Safari。
我认为它应该是一个处理Javascript的问题,因为它大部分是。但是,在Safari中关闭Javascript后,仍然没有发布数据。
表格现场直播:
我在页面顶部添加了这段文字, ($ _ SERVER ['REQUEST_METHOD'] =='),用于测试,以确保数据是否已发布。
POST'){
echo'post';
} else {
echo'niets gepost';
}
任何想法在哪里寻找答案?
编辑:这里是表单(输出HTML)
< form name =registerformid =registerformaction =http://tpgrf.nl/testserver/alpha/account/registreer/method =post>
< script type =text / javascript>
jQuery(document).ready(function($){
//因为我们希望用户使用电子邮件登录,所以不需要注册用户名,因此username字段=电子邮件字段
$(#user_login)。live('change',function(){
$('#user_email')。val($(#user_login).val()) ;
});
//根据所选角色显示字段
$('#role')。live('change',function(){
if($('#role')。val()==='docent'){
$('#messageRegisterDocent')。show();
$('#pKlas') .hide();
} else {
$('#messageRegisterDocent')。hide();
$('#pKlas')。show();
}
});
// json调用automcplete School
var ajaxurl ='http://tpgrf.nl/testserver/alpha/wp-a自动完成({
延迟:0,
minLength:1,
source:function(req,响应){
$ .getJSON('http://tpgrf.nl/testserver/alpha/wp-admin/admin-ajax.php?callback=?&action=school_autocomplete',req,response);
},
select:function(event,ui){
$('#school')。val(ui.item.label);
$('#school_id')。val(ui.item.school_id);
}
});
});
< / script>
< p>
< input type =hiddenname =user_emailid =user_emailclass =inputvalue =size =20/>
< p>
< label for =user_login>电子邮件< / label>
< input type =emailname =user_loginid =user_loginclass =inputvalue =size =20/>
< / p>
< p>
< label> Voornaam< / label>
< input id =first_nametype =textsize =25value =name =first_name/>
< / p>
< p>
< label> Achternaam< / label>
< input id =last_nametype =textsize =25value =name =last_name/>
< / p>
< p>
< label> Ik本...< / label>
< option value => ... selecteer< / option>
< option value =leerling> Leerling< / option>
< option value =docent> Docent< / option>
< / select>
< / p>
< p>
< label> Mijn school< / label>
< input type =textid =schoolclass =autoCompletesize =25value =name =school/>
< input type =hiddenid =school_idname =school_idvalue =>
< / p>
< p id =pKlasstyle =display:none;>
< label> Mijn klas< / label>
< input type =textid =klassize =25value =name =klas/>
< / p>
< p id =reg_passmail>通过e-mail ontvangen发送电子邮件。< / p>
< p class =submit>
< a href =>< input type =submitname =wp-submitid =wp-submitvalue =Registratie/>< / a>
< a href =/ account / login>我的帐户...< / a>
< input type =hiddenname =redirect_tovalue =/ testserver / alpha / account / login /?checkemail = registered/>
< input type =hiddenname =instancevalue =/>
< / p>
< / form>
您的问题可能是由以下代码行引起的:
< a href =>< input type =submitname =wp-submitid =wp-submitvalue =注册/>< / a>
将提交按钮标记封装在指向空白网址的a标记中,仅指向当前页面的链接。这可能是Safari不能很好地解析这个包装好的按钮,而是更喜欢通过提交按钮的A链接。
解开'input'标记并将代码更改为:
< input type =submitname =wp-submitid =wp-submitvalue =Registratie/>
可能会有效。
I've got a registration form setup which works fine on all browsers...except Safari.I thought it should be a problem that deals with Javascript, as it mostly is. But after I turned Javascript off in Safari, there's still no data being posted.
The form is live on:http://tpgrf.nl/testserver/alpha/account/registreer/
I've added this text on top of the page, for testing, to make sure if data has been posted or not.
if($_SERVER['REQUEST_METHOD'] == 'POST'){
echo 'post';
}else{
echo 'niets gepost';
}
Any thoughts where to look for the answer?
EDIT: Here's the form (output HTML)
<form name="registerform" id="registerform" action="http://tpgrf.nl/testserver/alpha/account/registreer/" method="post">
<script type="text/javascript">
jQuery(document).ready(function($) {
//Since we want users to login with there email; there's no need to also register a username. Therefore the username field = email field
$("#user_login").live('change', function(){
$('#user_email').val($("#user_login").val());
});
//Display fields, depending on the selected role
$('#role').live('change', function(){
if($('#role').val() === 'docent'){
$('#messageRegisterDocent').show();
$('#pKlas').hide();
}else{
$('#messageRegisterDocent').hide();
$('#pKlas').show();
}
});
//The json call to automcplete School
var ajaxurl = 'http://tpgrf.nl/testserver/alpha/wp-admin/admin-ajax.php';
$("#school").autocomplete({
delay: 0,
minLength: 1,
source: function(req, response){
$.getJSON('http://tpgrf.nl/testserver/alpha/wp-admin/admin-ajax.php?callback=?&action=school_autocomplete', req, response);
},
select: function(event, ui){
$('#school').val(ui.item.label);
$('#school_id').val(ui.item.school_id);
}
});
});
</script>
<p>
<input type="hidden" name="user_email" id="user_email" class="input" value="" size="20" />
<p>
<label for="user_login">E-mail</label>
<input type="email" name="user_login" id="user_login" class="input" value="" size="20" />
</p>
<p>
<label>Voornaam</label>
<input id="first_name" type="text" size="25" value="" name="first_name" />
</p>
<p>
<label>Achternaam</label>
<input id="last_name" type="text" size="25" value="" name="last_name" />
</p>
<p>
<label>Ik ben...</label>
<select name="role" id="role">
<option value="">...selecteer</option>
<option value="leerling" >Leerling</option>
<option value="docent" >Docent</option>
</select>
<p class="message" id="messageRegisterDocent" style="display:none;"><strong>Let op:</strong> registreer met uw e-mailadres van de school waar u werkzaam bent. <br />Voor een aantal functies vindt namelijk handmatige autorisatie plaats; dit is niet mogelijk met een privé e-mailadres.</p>
</p>
<p>
<label>Mijn school</label>
<input type="text" id="school" class="autoComplete" size="25" value="" name="school" />
<input type="hidden" id="school_id" name="school_id" value="">
</p>
<p id="pKlas"style="display:none;">
<label>Mijn klas</label>
<input type="text" id="klas" size="25" value="" name="klas" />
</p>
<p id="reg_passmail">U zult een wachtwoord per e-mail ontvangen.</p>
<p class="submit">
<a href=""><input type="submit" name="wp-submit" id="wp-submit" value="Registratie" /></a>
of <a href="/account/login">Ik heb al een account...</a>
<input type="hidden" name="redirect_to" value="/testserver/alpha/account/login/?checkemail=registered" />
<input type="hidden" name="instance" value="" />
</p>
</form>
Your problem might be caused by the following line of code:
<a href=""><input type="submit" name="wp-submit" id="wp-submit" value="Registratie" /></a>
You wrap the submit button tag inside an 'a' tag which is pointing to an empty URL and causes a link to the current page only. It might be that Safari does not parse this wrapped button well, and instead prefers the A link over the submit button.
Unwrapping the 'input' tag and changing the code to:
<input type="submit" name="wp-submit" id="wp-submit" value="Registratie" />
might work.
这篇关于表单提交不发布Safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!