我有2个表格。我要求在第一个表单中使用API-KEY int来在第二个表单的某些输入中加载值帐户并提交它。
第一种形式:
<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>
第二个是这样的:
<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>
如果页面是否完全重新加载,我别无选择。必要的是通过第一种形式的API KEY从第二种形式预加载一些数据。
答案 0 :(得分:-2)
您可以在form1中使用LocalDB js。 创建一个js来编写你的api值,并在提交form2时...收到这个信息并填写你需要的地方。
Localdb支持刷新,不会丢失数据。