gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 05:57:11 25 4
gpt4 key购买 nike

我有一个与 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 -->

付款按钮 > 表单

<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>

最佳答案

成功 URL 应重定向回带有 GET 参数“payment-success=1”的表单,然后您可以创建一个封装表单的条件:

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

关于javascript - 隐藏div中的表单并仅在重定向后显示它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39876795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com