仅HTML格式的拉丁字符 [英] Latin characters only in HTML form

查看:45
本文介绍了仅HTML格式的拉丁字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力做到这一点,以便我的HTML表单仅接受拉丁字母中的字符.该网站是中东潜在客户经常光顾的地方,但他们经常用阿拉伯语或东亚语言字符输入.我试图使用网络上其他地方找到的代码,但无济于事.我在下面粘贴了我的表单代码.我该怎么做呢?它将粘贴到Wix网站上的iFrame中.

I am looking to make it so that my HTML form will only accept characters from the Latin alphabet. The site is frequented by potential clients in the Middle East but they often type in Arabic or with characters from East Asian languages. I have tried to use code found elsewhere on the web but to no avail. I have pasted my form code below. How can I make this so? It is pasted within an iFrame on a Wix website.

谢谢.

<font face="helvetica" <META HTTPS-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
  <!--  ----------------------------------------------------------------------  -->
  <!--  NOTE: Please add the following <FORM> element to your page.             -->
  <!--  ----------------------------------------------------------------------  -->
  <form action="https://example.example.com/servlet/servlet.example?encoding=UTF-8" method="POST" target='_parent'>

    <input type=hidden name="oid" value="00D0Y0000034cvq">
    <input type=hidden name="retURL" value="https://example.com/successful-registration">

    <!--  ----------------------------------------------------------------------  -->
    <!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
    <!--  these lines if you wish to test in debug mode.                          -->
    <!--  <input type="hidden" name="debug" value=1>                              -->
    <!--  <input type="hidden" name="debugEmail"                                  -->
    <!--  value="example.example@example.com">                                     -->
    <!--  ----------------------------------------------------------------------  -->

    <label for="first_name">First Name</label> &nbsp;&nbsp;<input id="first_name" maxlength="40" name="first_name" size="20" type="text" required=true/><br><br>


    <label for="middle_name">Middle Name</label>&nbsp;&nbsp; <input id="middle_name" maxlength="80" name="middle_name" size="20" type="text" /><br><br>

    <label for="last_name">Last Name</label>&nbsp;&nbsp; <input id="last_name" maxlength="80" name="last_name" size="20" type="text" required=true /><br><br> Date of Birth:&nbsp;&nbsp;<span class="dateInput dateOnlyInput"> <input  id="00N0Y00000RWiNa" name="00N0Y00000RWiNa" size="12" type="text" name="inputBox" placeholder=" DD/MM/YYY" /></span><br><br>

    <label for="city">City</label>&nbsp;&nbsp; <input id="city" maxlength="40" name="city" size="20" type="text" /><br><br>

    <label for="country_code">Country</label> &nbsp;&nbsp;<select id="country_code" name="country_code"><option value="">--None--</option><option value="BH">Bahrain</option>
    <option value="EG">Egypt</option>
    <option value="JO">Jordan</option>
    <option value="KW">Kuwait</option>
    <option value="LB">Lebanon</option>
    <option value="MA">Morocco</option>
    <option value="OM">Oman</option>
    <option value="OTHER">Other</option>
    <option value="QA">Qatar</option>
    <option value="SA">Saudi Arabia</option>
    <option value="SY">Syria</option>
    <option value="AE">United Arab Emirates</option>
    <option value="GB">United Kingdom</option>
    </select><br><br>

    <label for="mobile">Mobile</label> &nbsp;&nbsp;<input id="mobile" maxlength="40" name="mobile" size="20" type="text" required=true/><br><br>

    <label for="email">Email</label>&nbsp;&nbsp; <input id="email" pattern="[^ @]*@[^ @]*" maxlength="80" name="email" size="20" type="text" required=true /><br><br> Current/Previous School/University:&nbsp; &nbsp;<input id="00N0Y00000RWiNZ" maxlength="100"
      name="00N0Y00000RWiNZ" size="20" type="text" /><br><br> Course you would like to study: &nbsp;&nbsp;<input id="00N0Y00000RWiNi" maxlength="255" name="00N0Y00000RWiNi" size="20" type="text" /><br><br>

    <label for="lead_source">Where did you hear about us?</label> &nbsp;&nbsp;<select id="lead_source" name="lead_source"><option value="">--None--</option>
    <option value="Instagram">Instagram</option>
    <option value="Facebook">Facebook</option>
    <option value="Twitter">Twitter</option>
    <option value="Google">Google</option>
    <option value="School Counsellor_(Please specify)">School Counsellor_(Please specify)</option>
    <option value="University Website_(Please specify)">University Website_(Please specify)</option>
    <option value="Web">Web</option>
    </select><br><br>

    <input type=hidden id="00N0Y00000RWvPA" name="00N0Y00000RWvPA" type="checkbox" value="1" />

    <center><input type="submit" name="submit"></center>



  </form>

推荐答案

检查此代码段.我在form元素中添加了以下更改作为属性.

Check this code snippet. I have added the following change in the form element as an attribute.

accept-charset="ISO-8859-1"

ISO-8859-1-拉丁字母的字符编码.

ISO-8859-1 - Character encoding for the Latin alphabet.

参考: https://www.w3schools.com/charsets/ref_html_8859.asp

<font face="helvetica" <META HTTPS-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
  <!--  ----------------------------------------------------------------------  -->
  <!--  NOTE: Please add the following <FORM> element to your page.             -->
  <!--  ----------------------------------------------------------------------  -->
  <form action="https://example.example.com/servlet/servlet.example?encoding=UTF-8" method="POST" target='_parent' accept-charset="ISO-8859-1">

    <input type=hidden name="oid" value="00D0Y0000034cvq">
    <input type=hidden name="retURL" value="https://example.com/successful-registration">

    <!--  ----------------------------------------------------------------------  -->
    <!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
    <!--  these lines if you wish to test in debug mode.                          -->
    <!--  <input type="hidden" name="debug" value=1>                              -->
    <!--  <input type="hidden" name="debugEmail"                                  -->
    <!--  value="example.example@example.com">                                     -->
    <!--  ----------------------------------------------------------------------  -->

    <label for="first_name">First Name</label> &nbsp;&nbsp;<input id="first_name" maxlength="40" name="first_name" size="20" type="text" required=true/><br><br>


    <label for="middle_name">Middle Name</label>&nbsp;&nbsp; <input id="middle_name" maxlength="80" name="middle_name" size="20" type="text" /><br><br>

    <label for="last_name">Last Name</label>&nbsp;&nbsp; <input id="last_name" maxlength="80" name="last_name" size="20" type="text" required=true /><br><br> Date of Birth:&nbsp;&nbsp;<span class="dateInput dateOnlyInput"> <input  id="00N0Y00000RWiNa" name="00N0Y00000RWiNa" size="12" type="text" name="inputBox" placeholder=" DD/MM/YYY" /></span><br><br>

    <label for="city">City</label>&nbsp;&nbsp; <input id="city" maxlength="40" name="city" size="20" type="text" /><br><br>

    <label for="country_code">Country</label> &nbsp;&nbsp;<select id="country_code" name="country_code"><option value="">--None--</option><option value="BH">Bahrain</option>
    <option value="EG">Egypt</option>
    <option value="JO">Jordan</option>
    <option value="KW">Kuwait</option>
    <option value="LB">Lebanon</option>
    <option value="MA">Morocco</option>
    <option value="OM">Oman</option>
    <option value="OTHER">Other</option>
    <option value="QA">Qatar</option>
    <option value="SA">Saudi Arabia</option>
    <option value="SY">Syria</option>
    <option value="AE">United Arab Emirates</option>
    <option value="GB">United Kingdom</option>
    </select><br><br>

    <label for="mobile">Mobile</label> &nbsp;&nbsp;<input id="mobile" maxlength="40" name="mobile" size="20" type="text" required=true/><br><br>

    <label for="email">Email</label>&nbsp;&nbsp; <input id="email" pattern="[^ @]*@[^ @]*" maxlength="80" name="email" size="20" type="text" required=true /><br><br> Current/Previous School/University:&nbsp; &nbsp;<input id="00N0Y00000RWiNZ" maxlength="100"
      name="00N0Y00000RWiNZ" size="20" type="text" /><br><br> Course you would like to study: &nbsp;&nbsp;<input id="00N0Y00000RWiNi" maxlength="255" name="00N0Y00000RWiNi" size="20" type="text" /><br><br>

    <label for="lead_source">Where did you hear about us?</label> &nbsp;&nbsp;<select id="lead_source" name="lead_source"><option value="">--None--</option>
    <option value="Instagram">Instagram</option>
    <option value="Facebook">Facebook</option>
    <option value="Twitter">Twitter</option>
    <option value="Google">Google</option>
    <option value="School Counsellor_(Please specify)">School Counsellor_(Please specify)</option>
    <option value="University Website_(Please specify)">University Website_(Please specify)</option>
    <option value="Web">Web</option>
    </select><br><br>

    <input type=hidden id="00N0Y00000RWvPA" name="00N0Y00000RWvPA" type="checkbox" value="1" />

    <center><input type="submit" name="submit"></center>



  </form>

这篇关于仅HTML格式的拉丁字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆