当我尝试点击提交或取消表单时,没有任何反应。
这是register_company.php代码的一部分。
在这里输入代码
<script type="text/JavaScript">
<!--
function getArrays() {
if (validateForm()) {
loadArray('appcatindex');
loadArray('targetindindex');
loadArray('managedservices');
document.getElementById('company').action = "<?php echo BASE_URL_JCM; ?>/save_company.php";
document.getElementById('company').submit();
} else {
return false;
}
}
function loadArray (tcIndex) {
if (document.getElementById(tcIndex) != null) {
lnLength = document.getElementById(tcIndex).length;
} else {
return true;
}
if (tcIndex == 'docindex') {
textDelim = "";
} else {
textDelim = "";
}
var lcIDs = "";
lcDelim = "";
for (var i=0;i<lnLength;i++) {
if (document.getElementById(tcIndex).options[i].selected) {
lcIDs = lcIDs + lcDelim + textDelim + document.getElementById(tcIndex).options[i].value + textDelim;
lcDelim = ",";
}
}
document.getElementById('a'+tcIndex).value = lcIDs;
}
function validateForm() {
lcReturn = "";
lcReturn = lcReturn + checkText('companyName','Company Name');
lcReturn = lcReturn + checkText('firstName','First Name');
lcReturn = lcReturn + checkText('contactEmail','Contact E-mail Address');
lcReturn = lcReturn + checkSelect('appcatindex','Application Categories');
lcReturn = lcReturn + checkSelect('targetindindex','Target Industries');
lcReturn = lcReturn + checkSelect('managedservices','Managed Services');
lcReturn = lcReturn + checkTextArea('hardwareTech','Hardware Technology');
lcReturn = lcReturn + checkTextArea('softwareTech','Software Technology');
lcReturn = lcReturn + checkTextArea('serviceSolution','Service Solutions');
lcReturn = lcReturn + checkTextArea('iaassolution','Infrastructure-as-Service(IaaS) Solution');
lcReturn = lcReturn + checkTextArea('paassolution','Platform-as-Service(PaaS) Solution');
lcReturn = lcReturn + checkTextArea('keyDiff','Key Differentiators');
lcReturn = lcReturn + checkTextArea('sampleCust','Sample Customer Names');
if (lcReturn != "") {
lcReturn = lcReturn + "\nPlease correct these fields and resubmit.";
alert(lcReturn);
return false;
}
return true;
}
function checkTextArea(tcField,tcLabel) {
lctext = "";
if (document.getElementById(tcField)) {
lctest = document.getElementById(tcField).value;
if (lctest.length > 250) {
lctext = tcLabel + " is greater than 250 characters ("+lctest.length+" used).\n";
}
}
return lctext;
}
function checkSelect(tcField,tcLabel) {
lctext = "";
if (document.getElementById(tcField)) {
lnLength = document.getElementById(tcField).length;
var lnSelCnt = 0;
for (var i=0;i<lnLength;i++) {
if (document.getElementById(tcField).options[i].selected) {
lnSelCnt++;
}
}
if (tcField!='appcatindex') {
if (tcField!='targetindindex') {
if (lnSelCnt > 5) {
lctext = tcLabel + " has more than 5 options selected ("+lnSelCnt+" selected).\n";
}
}
}
if (tcField=='appcatindex') {
if (lnSelCnt > <?php echo $saasAppCoLimit ?>)
{
lctext = tcLabel + " has more than <?php echo $saasAppCoLimit ?> options selected ("+lnSelCnt+" selected).\n";
}
}
if (tcField=='targetindindex' ) {
if (lnSelCnt > <?php echo $saasIndCoLimit ?>)
{
lctext = tcLabel + " has more than <?php echo $saasIndCoLimit ?> options selected ("+lnSelCnt+" selected).\n";
}
}
}
return lctext;
}
function checkText(tcField,tcLabel) {
lctext = "";
if (document.getElementById(tcField)) {
lctest = document.getElementById(tcField).value;
if (lctest == "") {
lctext = tcLabel + " is empty. This field is required.\n";
}
}
return lctext;
}
function updateStatus (toOption) {
lcStatus = toOption.value;
lcStatus = lcStatus.substring(0,1);
document.getElementById('status').value = lcStatus;
}
-->
</script>
<div id="divMain" align="center">
<div id="divContent" align="left">
<!--img src="<?php echo DOMAIN_URL ?>/343/images/company.jpg" border="0" width="670px" align="top" -->
<form name='company' id='company' method='post' action=''>
<!-- h3><?php echo $headtitle ?></h3 -->
<input type='button' value='Submit' onclick='getArrays();return false;' /> <input type='button' value='Cancel' onclick='self.close();' />
<input type="hidden" name="companyid" id="companyid" value="<?php echo $companyid ?>"><input type="hidden" name="querytype" id="querytype" value="<?php echo $querytype ?>">
<input type="hidden" name="profiletype" id="profiletype" value="<?php echo $profiletype ?>"><input type="hidden" name="status" id="status" value="<?php echo $status ?>">
<input type="hidden" name="key" id="key" value="<?php echo $key ?>"><input type="hidden" name="createDate" id="createDate" value="<?php echo $createDate ?>">
<input type="hidden" name="updateDate" id="updateDate" value="<?php echo $updateDate ?>"><input type="hidden" name="enablingTech" id="enablingTech" value="<?php echo $enablingTech ?>">
<input type="hidden" name="paas" id="paas" value="<?php echo $paas ?>"><input type="hidden" name="iaas" id="iaas" value="<?php echo $iaas ?>">
<input type="hidden" name="aappcatindex" id="aappcatindex" value=""><input type="hidden" name="atargetindindex" id="atargetindindex" value="">
<input type="hidden" name="amanagedservices" id="amanagedservices" value=""><input type="hidden" name="request_uri" id="request_uri" value="<?php echo $request_uri ?>">
</form>
</div>
</div>
&#13;
问题只与提交按钮有关,它什么也没做,我用Google搜索但没有找到任何可行的解决方案。
答案 0 :(得分:0)
您有一个</form>
标记,但没有<form>
标记。像<form action="action_page.php" method="post">
这样的东西应该有效。您还可以将javascript操作附加到提交按钮。
答案 1 :(得分:0)
这是我的问题的答案。
更改了输入类型&#34;按钮&#34;提交&#34;提交&#34;,它开始像魅力一样工作。
then