我一直试图推荐第三方表格一段时间,无论我做什么,我都没有得到结果。我是非常新的,我想知道如果没有控制action属性指向的页面可能会阻止我的进度。这是我设法组建的代码,用于确定在表单提交后将表单重定向到哪个URL。它基于用户在表单上选择的选项。
例如,如果他们想去伯明翰的工作室或在伦敦的工作室,他们将被发送到不同的页面。
为此我需要访问action属性指向的url吗? 代码还有什么其他问题吗?
如果我将action属性指向一个函数而不是它可以工作,还是会导致表单出现问题?
<script type="text/javascript">
function get_action() {
var optn = document.getElementById("signup_User5");
var optn_value= optn.value;
var option = document.getElementById("signup_User8");
var option_value= option.value;
if ((option_value=="Workshop Only") && (optn_value=="London")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcuklondonworkshop.html";
} else if ((option_value=="Workshop Only") && (optn_value=="Birmingham")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcukbirminghamworkshop.html";
} else if ((option_value=="Workshop Only") && (optn_value=="Manchester")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcukmanchesterworkshop.html";
} else if ((option_value=="Audition Only") && (optn_value=="London")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcuk-london-audition-confirmation.html";
} else if ((option_value=="Audition Only") && (optn_value=="Birmingham")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcuk-birmingham-audition-confirmation.html";
} else if ((option_value=="Audition Only") && (optn_value=="Manchester")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcuk-manchester-audition-confirmation.html";
} else if ((option_value=="Audition + Workshop") && (optn_value=="London")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcuk-london-audition-confirmation.html";
} else if ((option_value=="Audition + Workshop") && (optn_value=="Birmingham")) {
document.signupForm.action = "http://www.mscurvaceousuk.com/mcuk-birmingham-audition-confirmation.html";
} else if ((option_value=="Audition + Workshop") && (optn_value=="Manchester"))
document.signupForm.action ="http://www.mscurvaceousuk.com/mcuk-manchester-audition-confirmation.html";
} return true;
}
</script>
<form name="signupForm" id="signupForm" target="_top" method="post" action="http://app.greenrope.com/j1.pl?9ec6ce8b4e17b30b7c2a75edc1c1a684716721de718b418721aa61ed83378739" onsubmit="return checkMandatory(); ">
<table><tbody>
<li class="formRow userFieldName" id="field_User5" ><label class="fieldName" id="labelUser5" for="signup_User5">Please select the closest city to where you live from the list<span class="reqMarker">*</span></label> <select name="User5" id="signup_User5"><option value="">Choose</option> <option value="London" >London</option><option value="Birmingham" >Birmingham</option><option value="Manchester" >Manchester</option></select>
</li>
<li class="formRow userFieldName" id="field_User8" ><label class="fieldName" id="labelUser8" for="signup_User8">Would you like to attend the workshop and/or audition?<span class="reqMarker">*</span></label> <select name="User8" id="signup_User8"><option value="">Choose</option> <option value="Workshop Only" >Workshop Only</option><option value="Workshop + Audition" >Workshop + Audition</option><option value="Audition Only" >Audition Only</option></select>
</li>
</ul>
</li>
</ul>
<ul id="teamSelection">
<li class="formRow joinRow"><span id="confirmText"> </span>
</li>
<input type="hidden" name="AutomaticTeamIDs" value="4" />
<input type="hidden" name="AutomaticTeamIDs" value="3" />
<input type="hidden" name="AutomaticTeamIDs" value="1" />
</ul>
</td>
</tr> </tbody>
</table>
<div id="reqInfo">* required information
</div>
<input id="formSubmit" type="submit" name="formSubmit" style="font-weight: bold; font-size: 16px; color: #000000; border-style: solid; border-width: 8px !important; border-color: #d3d3d3 !important; border-radius: 0px !important; padding: 16px !important; background: #a9a9a9 !important; box-shadow: none !important;" value="Sign Me Up" onsubmit="return get_action();"/>
</form>