Javascript在一个页面中处理2个表单
我有两张表格。我要求在第一个表单中提供一个API-KEY,以便在第二个表单的一些输入中加载值帐户并提交它 第一种形式:Javascript在一个页面中处理2个表单,javascript,html,Javascript,Html,我有两张表格。我要求在第一个表单中提供一个API-KEY,以便在第二个表单的一些输入中加载值帐户并提交它 第一种形式: <form id="formAPI" name="formAPI"> <label for="" >API-KEY</label> <input type="text" class="form-control" id="inputApi" placeholder="XXX-XXX> &l
<form id="formAPI" name="formAPI">
<label for="" >API-KEY</label>
<input type="text" class="form-control" id="inputApi" placeholder="XXX-XXX>
<input id="continue" type="submit" value='Continue' onclick="submit_api()"/>
</form>
API-KEY
您可以在form1中使用LocalDB js。
创建一个js来编写api值,并在提交表单2时。。。接收此信息并在需要时填写
Localdb支持刷新,不丢失数据
例如:
第一个表单的提交处理程序需要为1。阻止提交2。使用键运行AJAX调用,并在回调中,将结果插入第二个表单。最简单的方法(1)是从第一个表单中删除
,因为您根本不需要它。我需要第一个表单,因为没有API密钥,我无法提交第二个表单。其思想是,用户必须选择一个设备,并进行一些操作,但在选择好的API键之后,如果使用AJAX填充第二个表单,则不需要
。输入和按钮就足够了。是的,好的,我正在尝试你的建议。
<form id="form2" >
<label for="inputName3" >Name</label>
<input type="text" id="inputName3">
<label for="selectDevices" >Device</label>
*here devices have to be loaded automatically due to the API KEY*
<select class="form-control" name ="device_s" id="id_devices">
<option value="1"> Device 1 </option>
<option value="2">Device 2</option>
<option value="3">Device 3</option>
</select
<input id="rule1" type="text" placeholder="Give a rule" />
<input id="btn2" type="submit" value='Submit' />
</form>