【问题标题】:Unable to click submit button on form in mobile browser无法在移动浏览器中单击表单上的提交按钮
【发布时间】:2020-11-25 06:03:52
【问题描述】:

我目前部署了一个带有联系表的网站。当点击提交提交表单时,无论是否完成,我尝试按下移动版网站上的提交按钮都没有反应。大多数移动浏览器都有同样的问题。这是带有表单的 html 页面。

<div class = "contact">
<div class = "emailBox">
    <div class = "emailBoxForm">
        <form (submit) = "onSubmit()">
            <h1>Contact</h1>
            <p>Lets get in touch. I'm open for hire and collaboration.</p>
            <ul id = "listForm">
                <li id = "inputForm"><input id = "form_field" type ="text"  required minlength="3" placeholder="Name" #name = "ngModel" [(ngModel)] = "content.subject" name = "content.subject" /></li>
                <li id = "inputForm"><input id = "form_field" type ="text" placeholder="Email"  required minlength="4" #email = "ngModel" [(ngModel)] = "content.email" name = "content.email"/></li>
                <li id = "inputForm"><textarea id = "form_field" type ="text" placeholder="Message"  required minlength="4" #message = "ngModel" [(ngModel)] = "content.message" name = "content.message"></textarea></li>
                <li id = "inputForm"><button type ="submit" id = "subButton">Submit</button></li>
            </ul>
        </form>
    </div>
    <div class = "feedBack">
        <div *ngFor="let needed of missing" style="color: red">
            <ul id = "feed">
                <li>{{needed}}</li>
            </ul>
        </div>
        <div *ngIf="feedBack" style = "color: green"><h3 id = "feed">Email Sent, Thank you.</h3></div> 
    </div>
</div>

补充一点,我下载了一个名为“JIDE”的安卓应用程序,可以在移动浏览器上显示任何日志错误。即使使用“JIDE”,也没有任何反应,就好像我根本没有触摸按钮一样。 FireFox 是我的 Android 手机上唯一可以正常工作的浏览器。 这是该网站的链接,目前正在处理证书。 http://anthonyrodriguez.me/

【问题讨论】:

  • 这仅在移动设备上发生,还是在 chrome 开发工具的移动视图中也发生?
  • 可能会尝试删除按钮的样式。看起来您的按钮在移动视图中不可点击。
  • 仅在大多数移动浏览器中。我已经从中删除了 css 动画,并且结果相同。 @HansakaSandaruwan

标签: html css angular frontend angular9


【解决方案1】:

您需要将(ngSubmit) 事件添加到您的表单以捕获提交事件。 尝试使用下面的代码。

<form name="emailBoxForm" (ngSubmit) = "onSubmit()" novalidate>
            <h1>Contact</h1>
            <p>Lets get in touch. I'm open for hire and collaboration.</p>
            <ul id = "listForm">
                <li id = "inputForm"><input id = "form_field" type ="text"  required minlength="3" placeholder="Name" #name = "ngModel" [(ngModel)] = "content.subject" name = "content.subject" /></li>
                <li id = "inputForm"><input id = "form_field" type ="text" placeholder="Email"  required minlength="4" #email = "ngModel" [(ngModel)] = "content.email" name = "content.email"/></li>
                <li id = "inputForm"><textarea id = "form_field" type ="text" placeholder="Message"  required minlength="4" #message = "ngModel" [(ngModel)] = "content.message" name = "content.message"></textarea></li>
                <li id = "inputForm"><button type ="submit" id = "subButton">Submit</button></li>
            </ul>
        </form>

【讨论】:

  • 遗憾的是,即使进行了调整,我仍然遇到同样的问题。
猜你喜欢
  • 2023-03-07
  • 2012-11-08
  • 2016-12-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-29
相关资源
最近更新 更多