隐藏div中的表单并仅在重定向后显示

时间:2016-10-05 14:31:48

标签: javascript php jquery redirect joomla

我有一个与Joomla组件一起使用的表单,我已经对其进行了广泛的修改。现在我想在表单之前添加付款集成。 我打算在页面上隐藏申请表,然后在成功从付款重定向后才显示它。我怎么能这样做? 代码: 申请表

<!-- Hide this agent form until page redirect(successful payment) -->
<?php  if($this->agent){ ?>
            <section id="contact-agent">
                <header><h2>APPLY FOR THIS DESIGN</h2></header>
                <div class="row">
                    <section id="contact-agent">
                <header><h2>APPLY FOR THIS DESIGN</h2></header>
                <div class="row">
                    <section class="agent-form">
                    <div class="col-md-5 col-sm-12">
                        <div class="agent-form">
                            <form role="form" id="form-contact-agent" method="post" action="<?php echo JRoute::_("index.php?option=com_bt_property"); ?>" class="clearfix">
                                <div class="form-group">
                                    <label for="form-contact-agent-name"><?php echo JText::_('COM_BT_PROPERTY_YOUR_NAME');?><em>*</em></label>
                                    <input type="text" class="form-control2" id="form-contact-agent-name" name="name" value="<?php echo $this->user->name; ?>" required>
                                </div><!-- /.form-group -->
                                <div class="form-group">
                                    <label for="form-contact-agent-email"><?php echo JText::_('COM_BT_PROPERTY_YOUR_EMAIL');?><em>*</em></label>
                                    <input type="email" class="form-control2" id="form-contact-agent-email" name="email" value="<?php echo $this->user->email; ?>" required>
                                </div><!-- /.form-group -->
                                <div class="form-group">
                                    <label for="form-contact-agent-phone"><?php echo JText::_('COM_BT_PROPERTY_YOUR_PHONE');?><em>*</em></label>
                                    <input type="text" class="form-control2" id="form-contact-agent-phone" name="phone" value="<?php echo $this->user->phone; ?>" required>
                                </div><!-- /.form-group -->
                                <div class="form-group">
                                    <label for="form-contact-agent-location"><em>Your Current Location*</em></label>
                                    <input type="text" class="form-control2" id="form-contact-agent-location" name="location" value="<?php echo $this->user->location; ?>" required>
                                </div><!-- /.form-group -->
                                <div class="form-group">
                                    <label for="form-contact-agent-proposed-location"><em>Proposed Property Location*</em></label>
                                    <input type="text" class="form-control2" id="form-contact-agent-proposed-location" name="proposedlocation" value="<?php echo $this->user->proposedlocation; ?>" required>
                                </div><!-- /.form-group -->
                                <div class="form-group">
                                    <label for="form-contact-agent-docs"><em>What documents are you applying for?*</em></label><br/>
                                    <input type="checkbox" class="form-control" name="ArchitecturalDrawing" value="<?php echo $this->user->ArchitecturalDrawing; ?>" />Architectural Drawing<br/>
                                    <input type="checkbox" class="form-control" name="StructuralDrawing" value="<?php echo $this->user->StructuralDrawing; ?>" />Structural Drawing<br/>
                                    <input type="checkbox" class="form-control" name="MechanicalDrawing" value="<?php echo $this->user->MechanicalDrawing; ?>" />Mechanical Drawing<br/>
                                    <input type="checkbox" class="form-control" name="ElectricalDrawing" value="<?php echo $this->user->ElectricalDrawing; ?>" />Electrical Drawing<br/>
                                    <input type="checkbox" class="form-control" name="boq" value="<?php echo $this->user->boq; ?>" />Bill of quantities (BOQ)<br/>
                                    <input type="checkbox" class="form-control" name="construction" value="<?php echo $this->user->construction; ?>" />Construction of building<br/>
                                </div><!-- /.form-group -->
                                <br/>
                                <div class="form-group">
                                <input type="checkbox" class="form-control" name="terms" value="<?php echo $this->user->terms; ?>" required/>I agree to the Tcs and Cs
                                </div><!-- /.form-group -->
                                <div class="form-group">
                                    <button type="submit" class="btn pull-right btn-default" id="form-contact-agent-submit">Apply Now</button>
                                </div><!-- /.form-group -->
                                <div id="form-contact-agent-status"></div>

                                <input type="hidden" name="agent_id" value="<?php echo $this->agent->id ?>">
                                <input type="hidden" name="task" value="agent.sendmsg" />
                                <input type="hidden" name="return" value="<?php echo base64_encode($this->uri->toString(array('path', 'query', 'fragment'))) ?>">
                                <?php echo JHtml::_('form.token'); ?>
                            </form><!-- /#form-contact -->
                        </div><!-- /.agent-form -->
                    </div><!-- /.col-md-5 -->
                </section><!-- /.agent-form -->
            </div><!-- /.row -->
        </section><!-- /#contact-agent -->

付款按钮&gt;表格

<form role="form" id="pay" method="post" action="<https://www.voguepay.com/pay">
<!-- Payment button (hide after successful redirect, show only agent form?) -->
        <div class="pay">
        <input type='hidden' name='v_merchant_id' value='demo' />
<input type='hidden' name='merchant_ref' value='SC-CommitmentFee' />
<input type='hidden' name='memo' value='SC- Design Commitment Fee' />

<input type='hidden' name='developer_code' value='500000d1c' />
<input type='hidden' name='store_id' value='1' />
<input type='hidden' name='success_url' value='' />
<input type='hidden' name='fail_url' value='' />

<input type='hidden' name='total' value='1500' />
<input type='image' align="right" src='http://voguepay.com/images/buttons/make_payment_green.png' alt='Submit' />   
</div>
</form>

1 个答案:

答案 0 :(得分:1)

成功网址应该重定向回GET参数为&#34; payment-success = 1&#34;的表单,然后您可以创建一个封装表单的条件:

$jinput = JFactory::getApplication()->input;
$paymentSuccess = $jinput->get('payment-success', '0', 'BOOL');
if ($paymentSuccess){
     /* Display the form */
}