簡體   English   中英

JavaScript驗證無效-我看不到任何錯誤

[英]Javascript validation not working - no error I can see

我有一個表單和一個帶有許多驗證的.js頁面。 它們主要是由其他人編寫的,我正在進行一些更改。 我只是在學習JavaScript,所以我還是一無所知。 這是表格(長度被截斷):

<?php
if (isset($_GET['invited'])) $invited = TRUE;
else $invited = FALSE;

// Using a manual keyword list now
$keywordList = array("Academic Success", "Accreditation", "Action Research", "Writing");
$keywordMenu = '<option value="">Choose...</option>';
foreach($keywordList as $word) if ($word!='') $keywordMenu .= "<option>$word</option>";
$keywordMenu .= '<option value="">Other:</option>';
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Annual Conference</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="http://mustus.edu/favicon.png" rel="shortcut icon">
<style type="text/css">
    @import url("http://www.mustus.edu/annualcon/style.css");
    @import url("http://mustus.edu/annualcon/newproposal_submit/proposal_submit.css");
</style>
<script type="text/javascript" src="proposal_submit.js"></script>
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/jquery/jquery.1.4.min.js"><!-mce:0-></script>
<script type="text/javascript" src="functions.js"></script>
</head>
<body>
<?php $includeFile = file_get_contents("http://www.mustus.edu/annualcon/header.php");
echo $includeFile;
?>

<?php
if ($invited) echo '<h2>Invited Presenter Session Submission Form</h2><h3>All Proposals Due June 16, 2014</h3>';
else 
echo '<h2>Proposal Submission Form </h2><h3>All Proposals Due June 16, 2014</h3>';
?>


<p style="color: red;">PLEASE NOTE THAT YOUR SUBMISSION IS NOT COMPLETE AND WILL NOT BE RECEIVED UNTIL YOU HIT THE SUBMIT BUTTON AND ARE REDIRECTED TO THE SUBMISSION COMPLETED PAGE.</p>
<p>Enter the requested information into each box below.</p>

<h3>Presenter Information</h3>
<form name="personForm" id="personForm" action="#" method="get" onsubmit="return false;">
    <p>Please list <b>all</b> presenters in the <b>order</b> in which they should be listed in the conference program.</p>
    <p style="color: red;"><b>NOTE: Only those presenters whose names are entered will be listed in the conference program.</b></p>
    <!-- Used only to limit word count for the abstract and category fields; put here so it won't go in the real form.-->
    <p><input type="hidden" name="abstrWordCount" value="75"></p>
    <p><input type="hidden" name="research3WordCount" value="200"></p>
    <p><input type="hidden" name="research4WordCount" value="200"></p>
    <p><input type="hidden" name="research5WordCount" value="200"></p>
    <p><input type="hidden" name="research6WordCount" value="200"></p>

</form>

<form name="realForm" id="realForm" action="process.php" method="post" enctype="multipart/form-data">
<h3>Session Information</h3>

<h3>Title: <textarea class="widerfield" name="title" cols="75" rows="3" id="title"></textarea></h3>

<h3>Session Abstract:</h3>
<h4 style="color: red;">Abstracts <em>must</em> be 75 words or less or your submission will be rejected! Please use your word processor to verify the word count before submitting.</h4>
<p>The only allowed formatting is bold and italics.</p>
<p>
 <textarea name="abstr" cols="40" rows="4"></textarea>
 </p>

<?php
function formatPulldown($id) {
    return <<<EndOfText
    <select name='requested_format[]' id='requestedFormat$id'>
        <option value=\"(didn't choose)\">Choose...</option>
        <option value='40-minute'>40-minute individual session</option>
        <option value='Panel'>Panel discussion</option>
        <option value='Poster'>All-conference interactive (poster) session</option>
        <option value='Pre-conference workshop'>Pre-conference workshop</option>
    </select>
EndOfText;
}
if (!$invited) echo '
    <h3>Preferred Session Format:</h3>
        <p>Please choose in order of preference. We will do our best to honor your preference, but it cannot be guaranteed.</p>
        <ol>
            <li>'.formatPulldown('1').'</li>
            <li>'.formatPulldown('2').'</li>
            <li>'.formatPulldown('3').'</li>
        </ol>';
?>

<h3>Proposal Category</h3>
<p>Please choose the category that best describes your submission.</p>
<p> 
    <select id="categories-select">
        <option value="0">Choose One</option>
        <option value="Research">Research</option>
        <option value="Innovation">Innovation</option>
        <option value="Application">Application</option>
        <option value="Integration">Integration</option>
    </select>
 </p>  
<div id="all-categoryDivs">
    <div class="categoryDivs" id="categoryDivResearch">
        <p>Indicate truncated<br>
        <textarea name="research3" cols="40" rows="4"></textarea>
        </div>

<div class="categoryDivs" id="categoryDivInnovation">
        <p>Describe the planned innovation addressed in your paper and what motivates it. Describe what you see in your students', 
        colleagues', or institution's behavior that you want to change. Describe the learning objectives you want students or colleagues
        to better achieve as a result of your innovation. <br>
        <textarea name="innovation3" cols="40" rows="4"></textarea></p> 
        </div>

    <div class="categoryDivs" id="categoryDivApplication">
        <p>Describe the theory, approach, and revision that you applied in your course, curriculum, or program. Describe
        what you saw in your students', colleagues', or institution's behavior that you wanted to change. Describe the learning
        objectives you wanted students or colleagues to better achieve as a result of your application.<br>
        <textarea name="application3" cols="40" rows="4"></textarea></p> 
        </div>

    <div class="categoryDivs" id="categoryDivIntegration">
        <p>Indicate the broad area of teaching and learning in higher education that you are integrating. Describe how your paper
        integrates the research of others in this area.<br>
        <textarea name="integration3" cols="40" rows="4"></textarea></p> 
        </div>
</div>


<h3>References:</h3>
<p>List references for citations you made in the above four boxes (use APA Style).</p>
<p><textarea name="references" cols="40" rows="4"></textarea></p>


<h3>Organization:</h3>
<p>Describe how your session will be conducted. Indicate how it will be organized and how participants will be involved.</p>
<p><textarea name="organization" cols="40" rows="4"></textarea></p>


<h3>Suggested Keywords:</h3>
    <p>Select at least 3 distinct keywords or short phrases that identify what your session is about. </p>
      <ol>
        <li><select name="keyword1"><?php echo $keywordMenu; ?></select><input type="text" name="keyword1_other"></li>
        <li><select name="keyword2"><?php echo $keywordMenu; ?></select><input type="text" name="keyword2_other"></li>
        <li><select name="keyword3"><?php echo $keywordMenu; ?></select><input type="text" name="keyword3_other"></li>
    </ol>

<h3>AV Requirements:</h3>
    <p>Check all equipment needed for your session. 
    <b>Note:</b> No AV equipment will be provided for poster sessions. </p>
    <p>
        <input type="checkbox" name="flipchart" id="flipchart" value="yes"><label for="flipchart">Flip chart</label><br>
        <input type="checkbox" name="video" id="video" value="yes"><label for="video">VCR/DVD player and monitor</label><br>
        <input type="checkbox" name="lcd" id="lcd" value="yes"><label for="lcd">LCD Projector <b>(You must supply your OWN computer and adapters; projectors are VGA)</b></label><br>
    </p>

<?php
if ($invited) echo '
        <h3>Topical tables:</h3>
        <p>
            If you would be willing to discuss your topic at a mealtime topical table, 
        </p><p>
            <input type="checkbox" name="table-fri_lunch" id="table-fri_lunch" value="yes"><label for="table-fri_lunch">Friday lunch</label><br>
            <input type="checkbox" name="table-fri_dinner" id="table-fri_dinner" value="yes"><label for="table-fri_dinner">Friday dinner</label><br>
            <input type="checkbox" name="table-sat_lunch" id="table-sat_lunch" value="yes"><label for="table-sat_lunch">Saturday lunch</label>
        </p>';
?>

<h3>Additional comments or questions you wish to share with the reviewers and/or conference planners:
 <textarea class="widerfield" name="comments" cols="75" rows="5" id="comments"></textarea></h3>

<p>
<h4>For content assistance, contact:</h4>
<address>Name<br>address</address>
<br><br>

<?php
if ($invited) { 
    echo '<p><input name="type" type="hidden" value="invited"></p>';
} else {
    echo '<p><strong><input type="checkbox" id="infocheck" name="infocheck" value="Yes"> Verification Statement: "I understand that failure to complete requested information in all boxes above
     will result in rejection of my proposal."</strong></p>';
}
?>

<p><input name="presenters" id="presenters" type="hidden"></p>
</form>
<h3>Review and Submit</h3>
<p>Please review this form. Once you are sure it is ready for submission, please click submit.</p>
<p class="buttons"><input type="button" id="submitButton" value="Submit proposal form"></p>

<?php $includeFile = file_get_contents("http://www.mustus.edu/annualcon/footer.php");
echo $includeFile;
?>
</body>
</html>

這是包含驗證的js文件:

//Set JSLint globals for debugging:
/*global window, CKEDITOR */

// Declaring our globals; the first two are declared on page load
var personForm, realForm, personCalled, personDbField, personFields;
personCalled = "presenter";
personDbField = "presenters";
personFields = ["first_name", "middle_name", "last_name", "department", "institution", "city", "state", "country", "office_phone", "cell_phone", "email_address", "website"];

// Make arrays searchable
Array.prototype.search = function(searchStr) {
    for (var i=0; i<this.length; i++) {
        if (this[i]===searchStr) { return true; }
    }
    return false;
};

function makeInputP(target, field, label) {
    var newP, newLabel, newInput;
    newP = document.createElement("p");
    newLabel = document.createElement("label");
    newLabel.appendChild(document.createTextNode(label));
    newInput = document.createElement("input");
    newInput.name = field;
    newP.appendChild(newLabel);
    newP.appendChild(newInput);
    target.appendChild(newP);
}

function addPerson(target, primary) {
    var newDiv, newH3, newButton, i, field, label;
    newDiv = document.createElement("div");
    newH3 = document.createElement("h3");
    newButton = document.createElement("input");
    newButton.type = "button";
    newButton.className = "addRemove";
    if (primary) {
        newButton.value = "Add "+personCalled+"(s)";
        newButton.onclick = function() {
            addPerson(target, false);
        };
        newH3.appendChild(document.createTextNode("Primary "+personCalled));
    } else {
        newButton.value = "Remove";
        newButton.onclick = function() {
            if (window.confirm("Delete this "+personCalled+"?")) {
                target.removeChild(this.parentNode);
            }
        };
        newH3.appendChild(document.createTextNode("Additional "+personCalled));
    }
    newDiv.appendChild(newButton);
    newDiv.appendChild(newH3);
    target.appendChild(newDiv);
    for (i=0; i<personFields.length; i++) {
        field = personFields[i];
        label = personFields[i].replace("_", " ") + ":";
        makeInputP(newDiv,field,label);
    }

}

function personObj(personDiv) {
    var personInputs, personData, field;
    personInputs = personDiv.getElementsByTagName('input');
    personData = {};
    for (field=0; field<personInputs.length; field++) {
        personData[personInputs[field].name] = personInputs[field].value;
    }
    return personData;
}

function peopleErrors(requiredFields) { // Returns false if okay, or a required field is empty, returns the field
    var people, person, personDiv, personInputs, field;
    people = personForm.getElementsByTagName('div');
    for (person=0; person<people.length; person++) {
        personDiv = people[person];
        personInputs = personDiv.getElementsByTagName('input');
        for (field=0; field<personInputs.length; field++) {
            if (requiredFields.search(personInputs[field].name)!==false && personInputs[field].value==='') {
                return personInputs[field];
            }
        }
    }
    return false;
}

function digestPerson(personDiv) {
    var personData, output, fieldName;
    personData = personObj(personDiv);
    output = '['+personData.last_name+', '+personData.first_name;
    if (personData.middle!=='') {
        output += ' '+personData.middle;
    }
    output += "]\n";
    for (fieldName in personData) {
        if (fieldName!=='prototype' && fieldName!=='' && fieldName!=='last_name' && fieldName!=='first_name' && fieldName!=='middle') {
            output += fieldName+' = '+personData[fieldName].replace(/[\r\n]+/,' | ')+"\n";
        }
    }
    output += '\n';
    return output;
}

function compilePeopleOutput() {
    var people, compiledPeople, person;
    people = personForm.getElementsByTagName('div');
    compiledPeople = '';
    for (person=0; person<people.length; person++) {
        compiledPeople += digestPerson(people[person]);
    }
    document.getElementById(personDbField).value = compiledPeople;
}



function stopWithAlert(msg,targ) {
    window.alert(msg);
    targ.focus();
    return false;
}

function verifyForm() {
    var requiredPeopleFields, pplErrs, a, b, c;
    requiredPeopleFields = ["first_name", "last_name", "department", "institution", "city", "country", "office_phone", "email_address"];
    pplErrs = peopleErrors(requiredPeopleFields);
    if (pplErrs) { return stopWithAlert("Please fill in this presenter's "+pplErrs.name.replace("_", " ")+".", pplErrs); }

    if (realForm.title.value==='') { return stopWithAlert("Please enter the title of this session.", realForm.title); }

    if (CKEDITOR.instances.abstr.getData()==='') { return stopWithAlert("Please provide an abstract of your session.", CKEDITOR.instances.abstr); }

    if (document.getElementById('requestedFormat1')) {
        for (a=1; a<=3; a++) {
            if (document.getElementById('requestedFormat'+a).selectedIndex===0) {
                return stopWithAlert("Please indicated your preferred presentation format in order of preference.", document.getElementById('requestedFormat'+a));
            } else {
                for (b=1; b<=3; b++) {
                    if (a!==b && document.getElementById('requestedFormat'+a).selectedIndex===document.getElementById('requestedFormat'+b).selectedIndex) {
                        return stopWithAlert("Please indicated your preferred presentation format in order of preference. You cannot choose the same format twice.", document.getElementById('requestedFormat'+a));
                    }
                }
            }
        }
    }

    for (c=1; c<=3; c++) {
        if (realForm['keyword'+c].selectedIndex===0 || (realForm['keyword'+c].selectedIndex===realForm['keyword'+c].options.length-1 && realForm['keyword'+c+'_other']==='')) {
            return stopWithAlert("Please select at least three keywords that apply to this session.", realForm['keyword'+c]);
        }
    }

    if (realForm.type.value != "invited" && realForm.infocheck.checked == false) {return stopWithAlert("Please read and agree to verification statement.", realForm.infocheck);}

//  
//     if (realForm.categories-select.value=='0') { return stopWithAlert("Please select a Proposal Category.", realForm.categories-select); }
// //   
//  if (realForm.references.value==='') { return stopWithAlert("Please provide references for your proposal.", realForm.references); }
//  
//  if (realForm.organization.value==='') { return stopWithAlert("Please provide session organization for your proposal.", realForm.organization); }



    //Otherwise, looks good!
    return true;
}

window.onload = function() {
    var i;

    personForm = document.getElementById("personForm");
    realForm = document.getElementById("realForm");

    addPerson(personForm, true);

    document.getElementById("submitButton").onclick = function() {
        if (verifyForm()) {
            compilePeopleOutput();
            realForm.submit();
        }
    };

    for (i=1; i<=5; i++) {
        realForm['keyword'+i].selectedIndex = 0;
        realForm['keyword'+i+'_other'].style.display = 'none';
        realForm['keyword'+i+'_other'].value = '';
    }

    function otherBlank() {
        if (this.selectedIndex===this.options.length-1)  {
            realForm[this.name+'_other'].style.display = 'block';
        } else {
            realForm[this.name+'_other'].style.display = 'none';
            realForm[this.name+'_other'].value = '';
        }
    }
    realForm.keyword1.onchange = otherBlank;
    realForm.keyword2.onchange = otherBlank;
    realForm.keyword3.onchange = otherBlank;

    //Setup CKEditor for abstract field
    CKEDITOR.replace( 'abstr', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });


    //Setup CKEditor for category fields - set each on separately because they can all be different
    CKEDITOR.replace( 'research3', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'research4', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'research5', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'research6', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'innovation3', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });


    CKEDITOR.replace( 'innovation4', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });


    CKEDITOR.replace( 'innovation5', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'innovation6', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });


    CKEDITOR.replace( 'application3', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'application4', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'application5', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'application6', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });

    CKEDITOR.replace( 'integration3', {
        extraPlugins: 'wordcount',  // enable wordcount plugin; customized to show count on top
        removePlugins: 'elementspath', // don't want the elements path in the corner
        resize_enabled: false,
        ForcePasteAsPlainText: true,
        height: 100,
        removeFormatTags: 'form,div,span,font,form,table,tr,td,input,textarea,script,a,p,br',
        toolbar: [ ['Cut','Copy','PasteText','-','Bold','Italic','-','Undo','Redo','-','SelectAll','RemoveFormat'] ],
        // This last section sets tag endings not to use "/>" (since not using XML)
        on:
        {
            instanceReady : function( ev )
            {
                this.dataProcessor.writer.selfClosingEnd = '>';
            }
        }
    });




};

四個無效的驗證沒有給出錯誤:

if (realForm.type.value != "invited" && realForm.infocheck.checked == false) {return stopWithAlert("Please read and agree to verification statement.", realForm.infocheck);}

//  
//     if (realForm.categories-select.value=='0') { return stopWithAlert("Please select a Proposal Category.", realForm.categories-select); }
// //   
//  if (realForm.references.value==='') { return stopWithAlert("Please provide references for your proposal.", realForm.references); }
//  
//  if (realForm.organization.value==='') { return stopWithAlert("Please provide session organization for your proposal.", realForm.organization); }

再一次,我很抱歉成為這樣的新手,感謝您的幫助。

由於如果($ invited){} else {}創建了一個輸入名稱=“ type”或一個輸入名稱=“ infocheck”,則這兩個之一將不存在。

您需要檢查realForm.type是否未定義:

// check if realForm.type doesn't exist:
if (realForm.elements.type === undefined && realForm.infocheck.checked == false) {return stopWithAlert("Please read and agree to verification statement.", realForm.infocheck);}

您還可以在else {}中添加PHP代碼

<input name="type" type="hidden" value="">

如果將其添加到PHP中,則可以使用realForm.type.value!=='invited'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM