I have created contact us page and called contact form block in content.When user submit for it redirect to contact/index instead of redirecting to current cms page that is contact-us.
I searched on internet but didn't found solution for magento 2.
Here is the code for contact form block:
{{block class="Magento\\Contact\\Block\\ContactForm" template="Magento_Contact::form-contact.phtml"}}
Can anyone suggest me how can i redirect it to contact-us page instead of contact/index.
UPDATE
Here is my form-contact.phtml code:
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<form class="form contact"
action="<?php /* @escapeNotVerified */ echo $block->getFormAction(); ?>"
id="contact-form"
method="post"
data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>"
data-mage-init='{"validation":{}}'>
<fieldset class="fieldset">
<div class="title-bonus-page">
<h2><?php /* @escapeNotVerified */ echo __('Send your comments') ?></h2>
</div>
<div class="col-sm-4">
<div class="left-input">
<div class="field name required">
<div class="control">
<input placeholder="<?php echo __('Your Name*')?>" name="name" id="name" title="<?php /* @escapeNotVerified */ echo __('Name') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/>
<i class="fa fa-user"></i>
</div>
</div>
<div class="field email required">
<div class="control">
<input placeholder="<?php echo __('Your Email*')?>" name="email" id="email" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/>
<i class="fa fa-envelope-o" aria-hidden="true"></i>
</div>
</div>
<div class="field telephone">
<div class="control">
<input placeholder="<?php echo __('Your Phone')?>" name="telephone" id="telephone" title="<?php /* @escapeNotVerified */ echo __('Phone Number') ?>" value="" class="input-text" type="text" data-validate="{required:true}"/>
<i class="fa fa-phone"></i>
</div>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="field comment required">
<div class="control">
<textarea placeholder="<?php echo __('Your Message*')?>" name="comment" id="comment" title="<?php /* @escapeNotVerified */ echo __('What’s on your mind?') ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"></textarea>
<i class="fa fa-file-text-o" aria-hidden="true"></i>
</div>
</div>
<?php echo $block->getChildHtml('form.additional.info'); ?>
<div class="actions-toolbar">
<div class="primary">
<input type="hidden" name="hideit" id="hideit" value="" />
<button type="submit" title="<?php /* @escapeNotVerified */ echo __('Send Message') ?>" class="action submit primary">
<span><?php /* @escapeNotVerified */ echo __('Send Message') ?></span>
</button>
</div>
</div>
</div>
</fieldset>
</form>
Update 2
The output of $block->getFormAction() is
http://www.siteurl/contact/index/post/