email 输入字段在 HTML 表单中无法识别值。

huangapple go评论69阅读模式
英文:

email Input field not recognising value in html form

问题

I have the same code for 2 fields, so I'm asking for a user to enter their email address into a form. It works for one but not the other. So when I select 'Headteacher' from the drop down and fill out the details as normal it works; but when I select 'Primary school teacher' from the drop down, and enter the details as normal - the email field comes up with an error "please enter a value"

code specific to the email input for Primary school:

<!-- primary school  -->
<div id="conditional-fields-primary-teacher" style="display: none;">
    <div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
    <div class="mc-field-group">
        <label for="mce-EMAIL">Email Address  <span class="asterisk">*</span>
        </label>
        <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
        <span id="mce-EMAIL-HELPERTEXT" class="helper_text"></span>
    </div>

code specific to the email input for headteacher:

<!-- Headteacher  -->
<div id="ht-conditional-fields" style="display: none;">
    <div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
    <div class="mc-field-group">
        <label for="mce-EMAIL">Email Address  <span class="asterisk">*</span>
        </label>
        <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
        <span id="mce-EMAIL-HELPERTEXT" class="helper_text"></span>
    </div>

This is the whole code for the file:

<!-- Begin Mailchimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-071822.css" rel="stylesheet" type="text/css;">
<style type="text/css">
    #mc_embed_signup{clear:left; font:14px Helvetica,Arial,sans-serif;}
    /* Add your own Mailchimp form style overrides in your site stylesheet or in this style block.
       We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
    <form action="x" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
        <div id="mc_embed_signup_scroll">
        <h2>Subscribe</h2>
        <div class="indicates-required"><span class="asterisk">*</span> indicates required</div>

        <div class="mc-field-group">
            <label for="mce-ROLE">Choose your role? <span class="asterisk">*</span></label>
            <select name="ROLE" class="required" id="mce-ROLE" required>
                <option value="">Select...</option>
                <option value="Primary school teacher">Primary school teacher</option>
                <option value="Headteacher">Headteacher</option>
                <option value="Parent / Guardian / Home Educator">Parent / Guardian / Home Educator</option>
                <option value="Other">Other</option>
            </select>
        </div>

    <!-- primary school  -->
    <div id="conditional-fields-primary-teacher" style="display: none;">
            <div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
        <div class="mc-field-group">
            <label for="mce-EMAIL">Email Address  <span class="asterisk">*</span></label>
            <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
            <span id="mce-EMAIL-HELPERTEXT" class="helper_text"></span>
        </div>
         <div class="mc-field-group">
                <label for="mce-FNAME">First name <span class="asterisk">*</span></label>
                <input type="text" value="" name="FNAME" class="required" id="mce-FNAME" required>
            </div>
            <div class="mc-field-group">
                <label for="mce-LNAME">Last name <span class="asterisk">*</span></label>
                <input type="text" value="" name="LNAME" class="required" id="mce-LNAME" required>
            </div>
            <div class="mc-field-group">
                <label for="mce-JOB_TITLE">Job title <span class="asterisk">*</span></label>
                <input type="text" value="" name="JOB_TITLE" class="required" id="mce-JOB_TITLE" required>
            </div>
            <div class="mc-field-group">
                <label for="mce-REGION">Region <span class="asterisk">*</span></label>
                <select name="REGION" class="required" id="mce-REGION" required>
                    <option value="">Select...</option>
                    <!-- List of regions -->
                </select>
            </div>
            <div class="mc-field-group">
                    <label>Year/Group (Tick all that apply):</label>
                <div>
                        <input type="checkbox" name="year-group" value="Reception" id="mce-reception">
                        <label for="mce-reception">Reception</label>
                </div>
                <!-- Other year/group checkboxes -->
            </div>
     </div>

    <!-- Headteacher  -->
    <div id="ht-conditional-fields" style="display: none;">
            <div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
       

<details>
<summary>英文:</summary>

I have the same code for 2 fields, so I&#39;m asking for a user to enter their email address into a form. It works for one but not the other. So when I select &#39;Headteacher&#39; from the drop down and fill out the details as normal it works; but when I select &#39;Primary school teacher&#39; from the drop down, and enter the details as normal - the email field comes up with an error &quot;please enter a value&quot; 
[the error when a value is added - Primary school teacher selected](https://i.stack.imgur.com/1N1DQ.png)

code specific to the email input for Primary school:
&lt;!-- primary school  --&gt;
&lt;div id=&quot;conditional-fields-primary-teacher&quot; style=&quot;display: none;&quot;&gt;
        &lt;div class=&quot;indicates-required&quot;&gt;&lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt; indicates required&lt;/div&gt;
    &lt;div class=&quot;mc-field-group&quot;&gt;
        &lt;label for=&quot;mce-EMAIL&quot;&gt;Email Address  &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;
    &lt;/label&gt;
        &lt;input type=&quot;email&quot; value=&quot;&quot; name=&quot;EMAIL&quot; class=&quot;required email&quot; id=&quot;mce-EMAIL&quot; required&gt;
        &lt;span id=&quot;mce-EMAIL-HELPERTEXT&quot; class=&quot;helper_text&quot;&gt;&lt;/span&gt;
&lt;/div&gt;

code specific to the email input for headteacher:

<!-- Headteacher -->
<div id="ht-conditional-fields" style="display: none;">
<div class="indicates-required"><span class="asterisk"></span> indicates required</div>
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address <span class="asterisk">
</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
<span id="mce-EMAIL-HELPERTEXT" class="helper_text"></span>
</div>




This is the whole code for the file:

<!-- Begin Mailchimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-071822.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{clear:left; font:14px Helvetica,Arial,sans-serif;}
/* Add your own Mailchimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. /
</style>
<div id="mc_embed_signup">
<form action="x" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h2>Subscribe</h2>
<div class="indicates-required"><span class="asterisk">
</span> indicates required</div>

    &lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-ROLE&quot;&gt;Choose your role? &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;select name=&quot;ROLE&quot; class=&quot;required&quot; id=&quot;mce-ROLE&quot; required&gt;
&lt;option value=&quot;&quot;&gt;Select...&lt;/option&gt;
&lt;option value=&quot;Primary school teacher&quot;&gt;Primary school teacher&lt;/option&gt;
&lt;option value=&quot;Headteacher&quot;&gt;Headteacher&lt;/option&gt;
&lt;option value=&quot;Parent / Guardian / Home Educator&quot;&gt;Parent / Guardian / Home Educator&lt;/option&gt;
&lt;option value=&quot;Other&quot;&gt;Other&lt;/option&gt;
&lt;/select&gt;
&lt;/div&gt;
&lt;!-- primary school  --&gt;
&lt;div id=&quot;conditional-fields-primary-teacher&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;indicates-required&quot;&gt;&lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt; indicates required&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-EMAIL&quot;&gt;Email Address  &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;
&lt;/label&gt;
&lt;input type=&quot;email&quot; value=&quot;&quot; name=&quot;EMAIL&quot; class=&quot;required email&quot; id=&quot;mce-EMAIL&quot; required&gt;
&lt;span id=&quot;mce-EMAIL-HELPERTEXT&quot; class=&quot;helper_text&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-FNAME&quot;&gt;First name &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;FNAME&quot; class=&quot;required&quot; id=&quot;mce-FNAME&quot; required&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-LNAME&quot;&gt;Last name &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;LNAME&quot; class=&quot;required&quot; id=&quot;mce-LNAME&quot; required&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-JOB_TITLE&quot;&gt;Job title &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;JOB_TITLE&quot; class=&quot;required&quot; id=&quot;mce-JOB_TITLE&quot; required&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-REGION&quot;&gt;Region &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;select name=&quot;REGION&quot; class=&quot;required&quot; id=&quot;mce-REGION&quot; required&gt;
&lt;option value=&quot;&quot;&gt;Select...&lt;/option&gt;
&lt;option value=&quot;Bedfordshire&quot;&gt;Bedfordshire&lt;/option&gt;
&lt;option value=&quot;Berkshire&quot;&gt;Berkshire&lt;/option&gt;
&lt;option value=&quot;Bristol&quot;&gt;Bristol&lt;/option&gt;
&lt;option value=&quot;Buckinghamshire&quot;&gt;Buckinghamshire&lt;/option&gt;
&lt;option value=&quot;Cambridgeshire&quot;&gt;Cambridgeshire&lt;/option&gt;
&lt;option value=&quot;Cheshire&quot;&gt;Cheshire&lt;/option&gt;
&lt;option value=&quot;Cornwall&quot;&gt;Cornwall&lt;/option&gt;
&lt;option value=&quot;Cumbria&quot;&gt;Cumbria&lt;/option&gt;
&lt;option value=&quot;Derbyshire&quot;&gt;Derbyshire&lt;/option&gt;
&lt;option value=&quot;Devon&quot;&gt;Devon&lt;/option&gt;
&lt;option value=&quot;Dorset&quot;&gt;Dorset&lt;/option&gt;
&lt;option value=&quot;Durham&quot;&gt;Durham&lt;/option&gt;
&lt;option value=&quot;East Sussex&quot;&gt;East Sussex&lt;/option&gt;
&lt;option value=&quot;Essex&quot;&gt;Essex&lt;/option&gt;
&lt;option value=&quot;Gloucestershire&quot;&gt;Gloucestershire&lt;/option&gt;
&lt;option value=&quot;Greater London&quot;&gt;Greater London&lt;/option&gt;
&lt;option value=&quot;Greater Manchester&quot;&gt;Greater Manchester&lt;/option&gt;
&lt;option value=&quot;Hampshire&quot;&gt;Hampshire&lt;/option&gt;
&lt;option value=&quot;Herefordshire&quot;&gt;Herefordshire&lt;/option&gt;
&lt;option value=&quot;Isle of Wight&quot;&gt;Isle of Wight&lt;/option&gt;
&lt;option value=&quot;Kent&quot;&gt;Kent&lt;/option&gt;
&lt;option value=&quot;Lancashire&quot;&gt;Lancashire&lt;/option&gt;
&lt;option value=&quot;Leicestershire&quot;&gt;Leicestershire&lt;/option&gt;
&lt;option value=&quot;Lincolnshire&quot;&gt;Lincolnshire&lt;/option&gt;
&lt;option value=&quot;Merseyside&quot;&gt;Merseyside&lt;/option&gt;
&lt;option value=&quot;Norfolk&quot;&gt;Norfolk&lt;/option&gt;
&lt;option value=&quot;North Yorkshire&quot;&gt;North Yorkshire&lt;/option&gt;
&lt;option value=&quot;Northamptonshire&quot;&gt;Northamptonshire&lt;/option&gt;
&lt;option value=&quot;Northumberland&quot;&gt;Northumberland&lt;/option&gt;
&lt;option value=&quot;Nottinghamshire&quot;&gt;Nottinghamshire&lt;/option&gt;
&lt;option value=&quot;Oxfordshire&quot;&gt;Oxfordshire&lt;/option&gt;
&lt;option value=&quot;Rutland&quot;&gt;Rutland&lt;/option&gt;
&lt;option value=&quot;Shropshire&quot;&gt;Shropshire&lt;/option&gt;
&lt;option value=&quot;Somerset&quot;&gt;Somerset&lt;/option&gt;
&lt;option value=&quot;South Yorkshire&quot;&gt;South Yorkshire&lt;/option&gt;
&lt;option value=&quot;Staffordshire&quot;&gt;Staffordshire&lt;/option&gt;
&lt;option value=&quot;Suffolk&quot;&gt;Suffolk&lt;/option&gt;
&lt;option value=&quot;Surrey&quot;&gt;Surrey&lt;/option&gt;
&lt;option value=&quot;Tyne and Wear&quot;&gt;Tyne and Wear&lt;/option&gt;
&lt;option value=&quot;Warwickshire&quot;&gt;Warwickshire&lt;/option&gt;
&lt;option value=&quot;West Midlands&quot;&gt;West Midlands&lt;/option&gt;
&lt;option value=&quot;West Sussex&quot;&gt;West Sussex&lt;/option&gt;
&lt;option value=&quot;West Yorkshire&quot;&gt;West Yorkshire&lt;/option&gt;
&lt;option value=&quot;Wiltshire&quot;&gt;Wiltshire&lt;/option&gt;
&lt;option value=&quot;Worcestershire&quot;&gt;Worcestershire&lt;/option&gt;
&lt;/select&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label&gt;Year/Group (Tick all that apply):&lt;/label&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Reception&quot; id=&quot;mce-reception&quot;&gt;
&lt;label for=&quot;mce-reception&quot;&gt;Reception&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 1&quot; id=&quot;mce-year1&quot;&gt;
&lt;label for=&quot;mce-year1&quot;&gt;Year 1&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 2&quot; id=&quot;mce-year2&quot;&gt;
&lt;label for=&quot;mce-year2&quot;&gt;Year 2&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 3&quot; id=&quot;mce-year3&quot;&gt;
&lt;label for=&quot;mce-year3&quot;&gt;Year 3&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 4&quot; id=&quot;mce-year4&quot;&gt;
&lt;label for=&quot;mce-year4&quot;&gt;Year 4&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 5&quot; id=&quot;mce-year5&quot;&gt;
&lt;label for=&quot;mce-year5&quot;&gt;Year 5&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 6&quot; id=&quot;mce-year6&quot;&gt;
&lt;label for=&quot;mce-year6&quot;&gt;Year 6&lt;/label&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;!-- Headteacher  --&gt;
&lt;div id=&quot;ht-conditional-fields&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;indicates-required&quot;&gt;&lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt; indicates required&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-EMAIL&quot;&gt;Email Address  &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;
&lt;/label&gt;
&lt;input type=&quot;email&quot; value=&quot;&quot; name=&quot;EMAIL&quot; class=&quot;required email&quot; id=&quot;mce-EMAIL&quot; required&gt;
&lt;span id=&quot;mce-EMAIL-HELPERTEXT&quot; class=&quot;helper_text&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-FNAME&quot;&gt;First name &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;FNAME&quot; class=&quot;required&quot; id=&quot;mce-FNAME&quot; required&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-LNAME&quot;&gt;Last name &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;LNAME&quot; class=&quot;required&quot; id=&quot;mce-LNAME&quot; required&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-JOB_TITLE&quot;&gt;Job title &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;JOB_TITLE&quot; class=&quot;required&quot; id=&quot;mce-JOB_TITLE&quot; required&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label for=&quot;mce-REGION&quot;&gt;Region &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
&lt;select name=&quot;REGION&quot; class=&quot;required&quot; id=&quot;mce-REGION&quot; required&gt;
&lt;option value=&quot;&quot;&gt;Select...&lt;/option&gt;
&lt;option value=&quot;Bedfordshire&quot;&gt;Bedfordshire&lt;/option&gt;
&lt;option value=&quot;Berkshire&quot;&gt;Berkshire&lt;/option&gt;
&lt;option value=&quot;Bristol&quot;&gt;Bristol&lt;/option&gt;
&lt;option value=&quot;Buckinghamshire&quot;&gt;Buckinghamshire&lt;/option&gt;
&lt;option value=&quot;Cambridgeshire&quot;&gt;Cambridgeshire&lt;/option&gt;
&lt;option value=&quot;Cheshire&quot;&gt;Cheshire&lt;/option&gt;
&lt;option value=&quot;Cornwall&quot;&gt;Cornwall&lt;/option&gt;
&lt;option value=&quot;Cumbria&quot;&gt;Cumbria&lt;/option&gt;
&lt;option value=&quot;Derbyshire&quot;&gt;Derbyshire&lt;/option&gt;
&lt;option value=&quot;Devon&quot;&gt;Devon&lt;/option&gt;
&lt;option value=&quot;Dorset&quot;&gt;Dorset&lt;/option&gt;
&lt;option value=&quot;Durham&quot;&gt;Durham&lt;/option&gt;
&lt;option value=&quot;East Sussex&quot;&gt;East Sussex&lt;/option&gt;
&lt;option value=&quot;Essex&quot;&gt;Essex&lt;/option&gt;
&lt;option value=&quot;Gloucestershire&quot;&gt;Gloucestershire&lt;/option&gt;
&lt;option value=&quot;Greater London&quot;&gt;Greater London&lt;/option&gt;
&lt;option value=&quot;Greater Manchester&quot;&gt;Greater Manchester&lt;/option&gt;
&lt;option value=&quot;Hampshire&quot;&gt;Hampshire&lt;/option&gt;
&lt;option value=&quot;Herefordshire&quot;&gt;Herefordshire&lt;/option&gt;
&lt;option value=&quot;Isle of Wight&quot;&gt;Isle of Wight&lt;/option&gt;
&lt;option value=&quot;Kent&quot;&gt;Kent&lt;/option&gt;
&lt;option value=&quot;Lancashire&quot;&gt;Lancashire&lt;/option&gt;
&lt;option value=&quot;Leicestershire&quot;&gt;Leicestershire&lt;/option&gt;
&lt;option value=&quot;Lincolnshire&quot;&gt;Lincolnshire&lt;/option&gt;
&lt;option value=&quot;Merseyside&quot;&gt;Merseyside&lt;/option&gt;
&lt;option value=&quot;Norfolk&quot;&gt;Norfolk&lt;/option&gt;
&lt;option value=&quot;North Yorkshire&quot;&gt;North Yorkshire&lt;/option&gt;
&lt;option value=&quot;Northamptonshire&quot;&gt;Northamptonshire&lt;/option&gt;
&lt;option value=&quot;Northumberland&quot;&gt;Northumberland&lt;/option&gt;
&lt;option value=&quot;Nottinghamshire&quot;&gt;Nottinghamshire&lt;/option&gt;
&lt;option value=&quot;Oxfordshire&quot;&gt;Oxfordshire&lt;/option&gt;
&lt;option value=&quot;Rutland&quot;&gt;Rutland&lt;/option&gt;
&lt;option value=&quot;Shropshire&quot;&gt;Shropshire&lt;/option&gt;
&lt;option value=&quot;Somerset&quot;&gt;Somerset&lt;/option&gt;
&lt;option value=&quot;South Yorkshire&quot;&gt;South Yorkshire&lt;/option&gt;
&lt;option value=&quot;Staffordshire&quot;&gt;Staffordshire&lt;/option&gt;
&lt;option value=&quot;Suffolk&quot;&gt;Suffolk&lt;/option&gt;
&lt;option value=&quot;Surrey&quot;&gt;Surrey&lt;/option&gt;
&lt;option value=&quot;Tyne and Wear&quot;&gt;Tyne and Wear&lt;/option&gt;
&lt;option value=&quot;Warwickshire&quot;&gt;Warwickshire&lt;/option&gt;
&lt;option value=&quot;West Midlands&quot;&gt;West Midlands&lt;/option&gt;
&lt;option value=&quot;West Sussex&quot;&gt;West Sussex&lt;/option&gt;
&lt;option value=&quot;West Yorkshire&quot;&gt;West Yorkshire&lt;/option&gt;
&lt;option value=&quot;Wiltshire&quot;&gt;Wiltshire&lt;/option&gt;
&lt;option value=&quot;Worcestershire&quot;&gt;Worcestershire&lt;/option&gt;
&lt;/select&gt;
&lt;/div&gt;
&lt;div class=&quot;mc-field-group&quot;&gt;
&lt;label&gt;Year/Group (Tick all that apply):&lt;/label&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Reception&quot; id=&quot;mce-reception&quot;&gt;
&lt;label for=&quot;mce-reception&quot;&gt;Reception&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 1&quot; id=&quot;mce-year1&quot;&gt;
&lt;label for=&quot;mce-year1&quot;&gt;Year 1&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 2&quot; id=&quot;mce-year2&quot;&gt;
&lt;label for=&quot;mce-year2&quot;&gt;Year 2&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 3&quot; id=&quot;mce-year3&quot;&gt;
&lt;label for=&quot;mce-year3&quot;&gt;Year 3&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 4&quot; id=&quot;mce-year4&quot;&gt;
&lt;label for=&quot;mce-year4&quot;&gt;Year 4&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 5&quot; id=&quot;mce-year5&quot;&gt;
&lt;label for=&quot;mce-year5&quot;&gt;Year 5&lt;/label&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;year-group&quot; value=&quot;Year 6&quot; id=&quot;mce-year6&quot;&gt;
&lt;label for=&quot;mce-year6&quot;&gt;Year 6&lt;/label&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;!-- dont change --&gt;
&lt;div id=&quot;mce-responses&quot; class=&quot;clear&quot;&gt;
&lt;div class=&quot;response&quot; id=&quot;mce-error-response&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;response&quot; id=&quot;mce-success-response&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
&lt;/div&gt;    
&lt;div style=&quot;position: absolute; left: -5000px;&quot; aria-hidden=&quot;true&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;b_ad6ea66c62b50396e776ca853_9731af2b4a&quot; tabindex=&quot;-1&quot; value=&quot;&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;input type=&quot;submit&quot; value=&quot;Subscribe&quot; name=&quot;subscribe&quot; id=&quot;mc-embedded-subscribe&quot; class=&quot;button&quot;&gt;&lt;/div&gt;

</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='EMAIL';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';fnames[3]='JOB_TITLE';ftypes[3]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<script type="text/javascript">
document.getElementById('mce-ROLE').addEventListener('change', function() {
var conditionalFields = document.getElementById('conditional-fields-primary-teacher');
var htConditionalFields = document.getElementById('ht-conditional-fields');
var pgheConditionalFields = document.getElementById('pghe-conditional-fields');
var otherConditionalFields = document.getElementById('other-conditional-fields');

if (this.value === &#39;Primary school teacher&#39;) {
conditionalFields.style.display = &#39;block&#39;;
htConditionalFields.style.display = &#39;none&#39;;
pgheConditionalFields.style.display = &#39;none&#39;;
otherConditionalFields.style.display = &#39;none&#39;;
} else if (this.value === &#39;Headteacher&#39;) {
conditionalFields.style.display = &#39;none&#39;;
htConditionalFields.style.display = &#39;block&#39;;
pgheConditionalFields.style.display = &#39;none&#39;;
otherConditionalFields.style.display = &#39;none&#39;;
} else if (this.value === &#39;Parent / Guardian / Home Educator&#39;) {
conditionalFields.style.display = &#39;none&#39;;
htConditionalFields.style.display = &#39;none&#39;;
pgheConditionalFields.style.display = &#39;block&#39;;
otherConditionalFields.style.display = &#39;none&#39;;
} else if (this.value === &#39;Other&#39;) {
conditionalFields.style.display = &#39;none&#39;;
htConditionalFields.style.display = &#39;none&#39;;
pgheConditionalFields.style.display = &#39;none&#39;;
otherConditionalFields.style.display = &#39;block&#39;;
} else {
conditionalFields.style.display = &#39;none&#39;;
htConditionalFields.style.display = &#39;none&#39;;
pgheConditionalFields.style.display = &#39;none&#39;;
otherConditionalFields.style.display = &#39;none&#39;;
}

});
</script>
<!--End mc_embed_signup-->


link to website https://careermapforprimary.co.uk/#register 
I&#39;ve tried changing fields and duplicating code but I can&#39;t find the error 
</details>
# 答案1
**得分**: 1
在HTML中,属性id必须是唯一的。
如果您的表单验证基于
`
document.getElementById('mce-EMAIL').value
`
它会获取具有id "mce-EMAIL" 的第一个元素的值,通常是在小学里的那个。
您必须使用不同的id。
<details>
<summary>英文:</summary>
in HTML the attribut id must be unique.
if verification of your form is based on 
`
document.getElementById(&#39;mce-EMAIL&#39;).value
`
it takes the value of the first element with the id &quot;mce-EMAIL&quot; found, so the one in primary school.
You must have distinct id
</details>

huangapple
  • 本文由 发表于 2023年3月31日 20:01:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/75898303.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定