我正在开发一个Android应用程序,它使用指向基于jQueryMobile的站点的WebView.通常,禁用软键盘上的"Go"按钮就像添加android:imeOptions="actionDone"到控件的XML标签一样简单.然而,在WebViews的情况下,这不起作用.
如何禁用"开始"按钮以自动执行表单提交,或者只是将其替换为"完成"按钮,就像android:imeOptions="actionDone"EditText一样?
我正在尝试编写一个greasemonkey脚本,通过浏览器更新项目集合的库存.为此,我需要自动填充几个表单并在提交按钮上模拟鼠标单击.我的表格填写正常,但我坚持按钮提交.
这是我试图模拟点击的按钮的HTML
<input type="submit" value="Find" style="" name="process-form" onclick="imhocaller.value='find-resources-page.left'; imhoaction.value='process-form';">
Run Code Online (Sandbox Code Playgroud)
我尝试过做这样的事,但没有运气.
document.getElementsByName('process-form').submit();
Run Code Online (Sandbox Code Playgroud)
如果需要,我可以发布更多代码.谢谢!
我正在努力学习dijit编辑器.我想用dijit编辑器widget替换现有的文本区域.所以我写了2个jsps - 一个使用dijit.Editor,它用编辑器内容提供另一个jsp.当我单击提交时,无论在文本区域编辑器中输入什么内容,第二个jsp "结果 "都会出现编辑器的空内容.
dijitEditor.jsp
<script type="text/javascript">
dojo.require("dijit.Editor");
dojo.require("dijit._editor.plugins.LinkDialog");
dojo.require("dijit._editor.plugins.AlwaysShowToolbar");
</script>
<script type="text/javascript">
dojo.addOnLoad(function(){
alert("addOnLoad function");
dojo.connect(dojo.byId('form1'), 'onsubmit', function(){
dojo.byId('editorContent').value= dijit.byId('content').getValue();
alert("Hidden variable");
alert(dojo.byId('editorContent').value);
alert("Editor content");
alert(dijit.byId('content').getValue());
});
});
</script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css" />
</head>
<body class=" claro ">
<FORM id="form1" METHOD=POST ACTION="result.jsp">
<table>
<tr>
<td>
<input type="hidden" name="editorContent" />
<div dojoType="dijit.Editor" id="content" onChange="console.log('editor1 onChange handler: ' + arguments[0])"
plugins="['foreColor','|','bold','italic','underline','|','createLink', 'unlink']"
extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']">
<p>
<b>This instance is created with a subset of functions enabled in the order …Run Code Online (Sandbox Code Playgroud) 我有一个表单+布局,如下所示:
<form ...>
<div id="editor">
[form html]
<input type="submit" value="Submit form" />
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
以下javascript:
$(function() {
var form = $('#editor').parents('form');
alert(form.length); // this alerts "1"
$(document).on('submit', 'form', function() {
alert('document form submit fired'); // this works as expected (alerts)
});
form.on('submit', function() {
alert('selected form submit fired'); // this is never alerted
});
});
Run Code Online (Sandbox Code Playgroud)
此表单不是通过ajax加载的.页面加载时,第一个对话框警告"1".但是,在提交表单时,只会触发一个警报 - 触发提交文档中所有表单的警报.
为什么会这样?
我试图用表单将一些文件提交到我的数据库.表单具有隐藏iframe的目标.当它完成加载时,我想要显示一条消息.
$("form#formPost").submit();
customFunction();
Run Code Online (Sandbox Code Playgroud)
这个例子似乎没有在触发customFunction()之前完成提交,这对于我正在设计的内容非常糟糕.
有没有办法在完成发送数据时执行某些操作?我正在环顾stackoverflow,并且没有很多帖子直接关于此.我觉得我必须进入目标iframe并在准备就绪时在那里执行代码,等等.有没有办法让它按我的意愿去做?
我试过的选项:
$("form#formPost").submit(function(){ customFunction(); });
Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery Validate插件通过发出ajax请求来确认我的表单中的电子邮件字段,以确保该电子邮件尚未被其他用户使用.我通过添加这样的规则来实现:
//make sure email field is on form before adding rule
if ($(".unique_email").is("*")) {
//remote validation
$(".unique_email").rules("add", {
remote: "http://test.nethop.com/test.cgi",
messages: {
remote: "This email is already in use"
}
});
}
Run Code Online (Sandbox Code Playgroud)
但是,每当我在表单上点击"提交"时,它将首先执行ajax请求以确保未收到电子邮件,然后即使电子邮件验证为好,也不会提交.你必须再次提交提交然后它将提交.有人知道为什么吗?
我已经设置了的jsfiddle证明的问题.如果您使用chrome开发人员工具或firebug,您可以看到正在创建,返回true但仍未提交的ajax请求.
HTML
<form id="listing" method="post">
<ul>
<li>
<label for="username">Email *</label>
<input type="text" name="username" id="username" autocomplete="off"
class="email required unique_email" value="test@test.com" />
</li>
<li>
<input type="submit" name="submit" id="submit" class="btn" value="Save"
/>
</li>
</ul>
</form>
Run Code Online (Sandbox Code Playgroud)
完整的脚本:
$(document).ready(function () {
var validator = $("form").validate({ …Run Code Online (Sandbox Code Playgroud) 只是制作一个简单的提交表单,似乎无法使其正常工作.
它甚至不会报告奇怪的错误.
检查了php.ini,一切看起来都很好.
HTML:
<form id="submit-form" action="receiving.php" method="POST">
<h3>Submit a Link</h3>
<fieldset>
<table>
<tr>
<td><label for="name">You</label></td>
<td><input id="name" name="name" type="text" placeholder="Your Twitter or Blog ect." /></td>
</tr>
<tr>
<td><label for="submit-links">Link(s)</label></td>
<td><input id="sumbit-links" name="submit-links" type="text" placeholder="" required="" /></td>
</tr>
<tr>
<td><input name="submit" type="submit" value="SUBMIT" /></td>
</tr>
</table>
</fieldset>
</form>
Run Code Online (Sandbox Code Playgroud)
receiving.php:
<?php
error_reporting(-1);
$name = $_POST['name'];
$submit-links = $_POST['submit-links'];
if(isset($_POST['submit'])){
$from_add = "submit@webdesignrepo.com";
$to_add = "ben@webdesignrepo.com";
$subject = "Your Subject Name";
$message = "Name:$name \n Sites: $submit-links";
$headers = 'From: submit@webdesignrepo.com' . …Run Code Online (Sandbox Code Playgroud) 我熟悉PhantomJS.但我不能得到一件事.我有一个简单形式的页面:
<FORM action="save.php" enctype="multipart/form-data" method="GET" onSubmit="return doSubmit();">
<INPUT name="test_data" type="text">
<INPUT name="Submit" type="submit" value="Submit">
</FORM>
Run Code Online (Sandbox Code Playgroud)
并且save.php只记下test_data值
所以我这样做:
page.evaluate(function() {
document.forms[0].test_data.value="555";
doSubmit();
});
Run Code Online (Sandbox Code Playgroud)
渲染页面时,我看到文本字段是555,但表单没有提交,save.php没有记下test_data值.所以doSubmit()不执行,是吗?doSubmit()是一个简单的验证步骤,提交应该加载下一页.
所以问题是:如何使用PhantomJS在页面上执行javascript代码?
最近我在发布表格时遇到了一个不寻常的问题.如果没有附件或附件图像文件大小小于100kb,表单帖子可以正常工作.但是当我尝试上传大于100kb的文件时,表单中没有任何元素被发布/提交.当我console.log()给它未定义的值.我无法理解导致问题的原因.控制台屏幕上不显示任何错误.有人可以帮忙解决这个问题吗?
var name = req.param('name');
console.log(name);
Run Code Online (Sandbox Code Playgroud)
我得到的结果是undefined.
我在Windows 8.1上使用sails v0.10.5.我使用postgres作为我的数据库.
我正在使用带有angular2的模板表单组件,我无法在提交表单后将焦点设置在我的firstName输入元素中.表单重新设置正常但无法设置焦点.
这是我的组件代码:
export class TemplateFormComponent {
@ViewChild('f') form: any;
onSubmit() {
if (this.form.valid) {
console.log("Form Submitted!");
this.form.reset();
this.form.controls.firstName.focus();
}
}
}
Run Code Online (Sandbox Code Playgroud)
和我的模板代码:
<form novalidate autocomplete="off" #f="ngForm" (ngSubmit)="onSubmit()">
<div class="form-group">
<label>First Name</label>
<input type="text"
class="form-control"
name="firstName"
[(ngModel)]="model.firstName"
required
#firstName="ngModel">
</div>
</form>
Run Code Online (Sandbox Code Playgroud) form-submit ×10
forms ×4
javascript ×4
jquery ×4
ajax ×1
android ×1
contact-form ×1
dojo ×1
greasemonkey ×1
html ×1
java ×1
jsp ×1
phantomjs ×1
php ×1
post ×1
sails.js ×1
setfocus ×1
submit ×1