从先前的模态启动新模态

时间:2013-11-14 06:41:34

标签: javascript codeigniter twitter-bootstrap modal-dialog

当我点击上一个模态的提交按钮时,是否可以启动新模态?我一整天都在尝试这样做而且我被困住了。我正在使用CodeIgniter。我试图在我的onclick中添加另一个功能,但它不起作用。

这是触发我的模态的按钮:

<a href="#" role="button" data-toggle="modal" onclick="loadModuleForm('<?php echo $this->config->item('8L_URL')."/propertymgt/form/add"; ?>')"><span class="btn btn-primary">Create</span></a>

这是我的模式:

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>Property Management</h3>
</div>

<div class="modal-body">
    <form class="form-horizontal" name="propertymgt-form" id="propertymgt-form" action="<?php echo $this->config->item('8L_URL')."/propertymgt/post/".$form_action; ?>" method="POST">
        <br />
        <div class="control-group">
            <label class="control-label" for="title">Title:</label>
            <div class="controls" style="margin-bottom:15px;">
                <input type="text" id="title" placeholder="Title" name="title" class="span5" value="<?php echo $title; ?>">
            </div>
            <label class="control-label" for="fullname">Fullname:</label>
            <div class="controls" style="margin-bottom:15px;">
                <input type="text" id="lastname" placeholder="Lastname" name="lastname" class="span3" value="<?php echo $lastname; ?>">
                <input type="text" id="firstname" placeholder="Firstname" name="firstname" class="span3" value="<?php echo $firstname; ?>">
                <input type="text" id="middlename" placeholder="Middlename" name="middlename" class="span3" value="<?php echo $middlename; ?>">
            </div>
            <label class="control-label" for="address">Address:</label>
            <div class="controls" style="margin-bottom:15px;">
                <input type="text" name="address" class="span3" id="address" placeholder="No., Street, Building" value="<?php echo $address; ?>">
                <input type="text" name="city" class="span3" id="city" placeholder="City" value="<?php echo $city; ?>">
                <input type="text"name="province" class="span3" id="province" placeholder="Province" value="<?php echo $province; ?>">
            </div>
        </div>
        <input type="hidden"name="uuid" class="span3" id="uuid" value="<?php echo $id; ?>">
    </form>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-primary" id="registration-submit" onClick="submitForm('propertymgt-form');loadModuleForm('<?php echo $this->config->item('8L_URL')."/propertymgt/form/add"; ?>');">Submit</button>
    <button type="button" data-dismiss="modal" class="btn">Close</button>
</div>

loadmoduleform()应加载我的新模态。我错过了什么吗?我需要别人的帮助。谢谢!

2 个答案:

答案 0 :(得分:2)

你想要这样的东西吗?

demo

你只需要隐藏第一个模态n在你的按钮点击功能上启动另一个模态

$('#newModal1').modal('hide');
$('#newModal2').modal('show');

答案 1 :(得分:0)

我刚刚调用了函数loadmoduleForm()的脚本。我现在要做的就是调用loadmoduleForm()所在的函数。不管怎么说,还是要谢谢你。 :)