如何创建自定义表单并从其调用职业 cms 页面?目前,我正在创建一个 cms 职业页面和一个核心模板文件,并使用
调用它{{block type="core/template" name="careerform" template="careerform/career_form.phtml"}}
这很好,我的career_form
是
<form action="<?php echo $this->getUrl('contacts/index/post'); ?>" id="contactForm" method="post" name="contact_form">
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="telephone"><?php echo Mage::helper('contacts')->__('Phone') ?></label>
<div class="input-box">
<input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Phone') ?>" value="" class="input-text" type="text" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Your Details') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Your Details') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
<li>
<label for="subject"><?php echo Mage::helper('contacts')->__('Which store?') ?> <span class="required">*</span></label>
<div class="input-box"><input name="subject" id="subject" title="<?php echo Mage::helper('contacts')->__('Which store? ') ?>" value="" class="required-entry input-text" type="text"/>
</div>
</li>
</ul>
</div>
<div class="buttons-set">
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
问题是这是重定向到联系我们页面 我想问一下,有谁知道如何实现职业形态吗? 谢谢
最佳答案
您已正确分配显示职业表单的文件,即career_form.phtml。现在您只需在此文件中创建简单的 HTML 表单,其中包含您需要的字段。
<form action="<?php echo $this->getUrl(''); ?>" id="carrer" method="post" name="carrer_form">
// Add the fields according to your requirement.
</form>
上面是创建表单后的表单,您需要更改表单的操作。在之前的表单中,即联系表单中,表单的操作指向
<?php echo $this->getUrl('contacts/index/post'); ?>
这给出了 url
www.your_domain.com/index.php/contacts/index/post
这是模块/ Controller /操作的位置,您可以在其中处理从表单发送的信息。您应该根据 Controller 操作更改此位置。
希望这会有所帮助。
关于javascript - Magento 创建自定义职业表单并从 CMS 页面调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29249606/