我有3个输入框,例如姓名,年龄,地址,然后它在底部有一个按钮,名为'apply‘...now当我点击'apply’按钮时,一个fancybox将弹出,并有另外3组输入框,例如公司,部门,主管。然后它在底部有一个“取消”和“提交”按钮...
下面是第一个表单的代码
<input type="text" name="name" value="" id="name/>
<input type="text" name="age value="" id="age"/>
<input type="text" name="address" value="" id="address" />
<a href="#anotherform" id="firstform" class="form-btn">Apply</a>下面是这个奇特盒子的第二个表单的代码
<form action ="#" method="post">
company: <input type="text" name="company" id="company" /><br/>
department: <input type="text" name="department" id="department" /><br/>
supervisor: <input type="text" name="supervisor" id="supervisor" /><br/>
<input type="button" name="cancelapply" id="submitapply" value="cancel" />
<input type="button" name="submitapply" id="submitapply" value="Submit" />
</form>这是我花哨的信箱代码
jQuery("a#firstform").fancybox({
'titlePosition' : 'inside',
'transitionIn' : 'none',
'transitionOut' : 'none',
'hideOnOverlayClick' : false,
'hideOnContentClick' : false,
'showCloseButton' : true,
//HOW TO PASS THE name,age,address to the fancybox when i click the
//'apply' button.
//and then when i submit the fancy box, i can get the
// 6 values ?
});发布于 2013-02-19 14:27:36
将fancybox代码放在第一个表单中,删除第二个表单上的标记,它应该作为一个表单与您的数据一起提交,即使它们是隐藏的。所以你应该只有一个表单标签。
发布于 2013-02-19 15:44:17
您已经有公司、部门、主管显示,对吗?如果我理解你的问题,这可能会起作用:
对花式盒子的更改
<form action ="#" method="post">
company: <input type="text" name="company" id="company" /><br/>
department: <input type="text" name="department" id="department" /><br/>
supervisor: <input type="text" name="supervisor" id="supervisor" /><br/>
name: <input type="text" id="name-verify/>
age: <input type="text" id="age-verify"/>
address: <input type="text" id="address-verify" />
<input type="button" name="cancelapply" id="submitapply" value="cancel"/>
<input type="button" name="submitapply" id="submitapply" value="Submit" />
</form>以及一些jQuery更改:
$('#firstform').click(function() {
$('#name-verify').val($('#name').val());
$('#age-verify').val($('#age').val());
$('#address-verify').val($('#address').val());
});https://stackoverflow.com/questions/14951063
复制相似问题