[英]How do you send selected data back from modal popup to parent form and close modal
我的上级表单中有以下代码,用于打开项目的模式列表视图。
<?php
// My Stuff
$field = $fieldSet['jform_my_stuff'];
?>
<div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>">
<div class="control-label">
<?php echo $field->label; ?>
</div>
<div class="controls">
<?php echo $field->input; ?>
<?php
JHTML::_('behavior.modal');
?>
<a class="modal"
<a href="index.php?option=com_popuptry&view=stuff&layout=stuff&tmpl=component" rel="{handler: 'iframe', size: {x: 800, y: 600}}">Select</a>
</div>
该表格如下所示。
我想要将数据更新到的领域是
jform_my_stuff
我尝试了很多选项,但无法获取返回所需输入的模态
我现在用一些txt代替了我所有的努力
最后一段代码会在这里
</td>
<?php endif; ?>
<td style="text-align:center">
<?php echo JDom::_('html.fly', array(
'dataKey' => 'stuff',
'dataObject' => $row
));?>
</td>
<td style="text-align:center">
Button here to send selected item (stuff) <br>back to parent feild called jform_my_stuff<br> & close modal
</td>
</tr>
<?php
$k = 1 - $k;
endfor;
?>
</tbody>
</table>
我完全迷失了我需要放在这里的东西,因为大多数事情都没有奏效。 任何指针表示赞赏。
您将需要使用Javascript。 (我在这里使用jQuery)。 我正在尽力了解您要做什么。
基本上,我会编写一个函数来处理按钮单击。
<input type="button" value="Click Me" onclick="sendToMyStuff()">
该功能如下:
function sendToMyStuff(){
var stuff = $('input[name="checkbox"]:checked').val(); // "stuff"
$('#mystuff').val(stuff); //Sent the value of the stuff input -- if it is not an input you can use .text()
$('#modal').hide(); //Hide the modal window
}
您也可以简单地使用复选框的ID来获取数据。 我不确定您要做什么。 我对Joomla也不是很熟悉。 您也可以绑定按钮单击。
$('#button').bind('click', function(){ }
希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.