表单与多个提交按钮查询外部网站
Form with multiple submit buttons that queries external website
嗨,我需要编写一个表单,查询外部网站与三个提交按钮的代码。每个提交按钮将发送一些共同的输入字段和一些相关的具体到个别机构。我相信我将需要使用JavaScript,但我不确定我能做些什么。下面是表单的结构:
<form action="external website" method="post">
{{ form_with common input selectors }}
<!-- if submit Option one is used -->
<input type="text" name="fixed" value="option one">
<!-- if submit Option two is used -->
<input type="text" name="fixed" value="option two">
<!-- if submit Option three is used -->
<input type="text" name="fixed" value="option three">
<input type="submit" name="Option one" value="option one" />
<input type="submit" name="Option two" value="option two" />
<input type="submit" name="Option three" value="option three" />
</form>
任何来自专家的帮助将不胜感激!
那些如果我正确理解你的问题,这将是你的答案。简单地发送三个值中的一个作为表单的一部分似乎是你所要求的。
这个问题相当模糊,所以这可能没有帮助。
<!-- ONLY ONE INPUT FIELD IS NEEDED -->
<input id="SOMETHING" type="text" name="fixed" value="">
<input type="submit" name="Option one" onClick="firstbutton();" value="option one" />
<input type="submit" name="Option two" onClick="secondbutton();" value="option two" />
<input type="submit" name="Option three" onClick="thirdbutton();" value="option three" />
</form>
<script type="text/javascript">
var input1 = "whatever input 1 will be";
var input2 = "whatever input 2 will be";
var input3 = "whatever input 3 will be";
function firstbutton() {
document.getElementById('SOMETHING').value = input1;
}
function secondbutton() {
document.getElementById('SOMETHING').value = input2;
}
function thirdbutton() {
document.getElementById('SOMETHING').value = input3;
}
</script>
将三个提交分为三个单独的表单,并为每个表单赋予不同的id (form1, form2, form3)。这样就容易多了。如果将AJAX与这些表单挂钩,那么就不必担心链接到这些表单的其他页面。
相关文章:
- 内部分区字体大小获胜'调整浏览器窗口大小时不会随媒体查询而更改
- 调整窗口大小时,可拖动的对象会出现在容器外部
- HTML表单提交时未执行外部函数
- j查询utc offSets的时差
- 通过在Dojo mobile ViewController.openExternalView中动态更改打开同一外部视图的
- 使用html中的外部javascript进行数据验证
- jQuery对请求图像的外部文本进行查询
- 包括从外部文件到HTML的查询功能(使用Dropbox进行本地测试)
- 谷歌应用程序脚本:如何使用电子表格中的数据查询外部数据库
- jQuery:CSS更改后,何时查询新的外部高度
- 运行查询并从外部站点检索 XML
- j查询如何禁用外部脚本触发的点击事件
- Firebase 使用外部查询结果函数
- 让jQuery函数使用来自外部php文件的数据和mySQL查询
- 如何查询外部域,将其存储在chrome扩展中,并调用它在popup.html中显示
- 如何通过Javascript在MongoDB 'where'查询中使用外部变量
- 如何在Angular.js指令中将service.js的内部查询结果绑定到外部变量
- 如何将具有phonegap数据库SQLite查询的内部函数的值返回到外部函数
- 表单与多个提交按钮查询外部网站
- 融合表查询:从外部链接放大标记