We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53148
    • 7 Posts
    Hi.
    I have an ugly form with many inputs, so I wanted to simplify it visually by placing some inputs into a modal, which will contain the submit button. But it isn't submitting when made so. See the markup for details.

    <form>
        <!-- some inputs, selects, checkboxes here -->
        ....
        <button type="button" data-call-modal=".modal">Go to last step</button> <!-- calls the modal -->
    
        <!-- the modal -->
        <div class="modal">
            <!-- some inputs here -->
            <input type="submit" value="Send"> <!-- it was supposed to do the magic :). But it doesn't, when placed here. If I place it outside of the modal, it works -->
        </div>
    </form>
    


    What could be the cause?
    Thanks.
      • 17301
      • 932 Posts
      Your form is just an empty tag it needs to have an action and a method. If you're using formIt then you'll need to add in:

      <form action="[[~[[*id]]]]" method="post">


      If you've just simplified it for the sake of posting it here then it may be worth posting up the more comprehensive markup to nail down the issue.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 53148
        • 7 Posts
        Quote from: lkfranklin at Jun 23, 2017, 02:34 PM
        If you've just simplified it for the sake of posting it here then it may be worth posting up the more comprehensive markup to nail down the issue. </form>

        The form is 100% сomplies with the FormIt documentation, I've just simplified it for posting here.
        The form submits, if submit button is outside of modal div.

        The actual markup shown below.

        [[!fi.error_message]]
        <form action="[[~[[*id]]]]" id="configuratorForm">
        	<div class="row">
        		<label class="col-xs-12 col-md-6">
        			<span>Модель</span>
        			<select name="model" class="form-control">
        				<option value="Баня-бочка классик" [[!+fi.model:FormItIsSelected=`классик`]] >Баня-бочка классик</option>
        				<option value="Баня-бочка квадро" [[!+fi.model:FormItIsSelected=`квадро`]] >Баня-бочка квадро</option>
        				<option value="Баня-бочка с верандой" [[!+fi.model:FormItIsSelected=`с верандой`]] >Баня-бочка с верандой</option>
        				<option value="Баня-бочка танк" [[!+fi.model:FormItIsSelected=`танк`]] >Баня-бочка танк</option>
        				<option value="Баня-бочка избушка" [[!+fi.model:FormItIsSelected=`избушка`]] >Баня-бочка избушка</option>
        				<option value="Баня-бочка люкс" [[!+fi.model:FormItIsSelected=`люкс`]] >Баня-бочка люкс</option>
        			</select>
        		</label>
        		<div class="col-xs-12 col-md-6">
        			<div class="row combined">
        				<label class="col-xs-6">
        					<span>Диаметр</span>
        					<select name="diameter" class="form-control">
        						<option value="2,2м" [[!+fi.diameter:FormItIsSelected=`2,2м`]] >2,2м</option>
        						<option value="2,4м" [[!+fi.diameter:FormItIsSelected=`2,4м`]] >2,4м</option>
        						<option value="3м" [[!+fi.diameter:FormItIsSelected=`3м`]] >3м</option>
        					</select>
        				</label>
        				<label class="col-xs-6">
        					<span>Длина</span>
        					<select name="length" class="form-control">
        						<option value="4м" [[!+fi.length:FormItIsSelected=`4м`]] >4м</option>
        						<option value="4,5м" [[!+fi.length:FormItIsSelected=`4,5м`]] >4,5м</option>
        						<option value="5м" [[!+fi.length:FormItIsSelected=`5м`]] >5м</option>
        						<option value="5,5м" [[!+fi.length:FormItIsSelected=`5,5м`]] >5,5м</option>
        						<option value="6м" [[!+fi.length:FormItIsSelected=`6м`]] >6м</option>
        					</select>
        				</label>
        			</div>
        		</div>
        		<label class="col-xs-12 col-md-6">
        			<span>Цвет кровли</span>
        			<select name="roofColor" class="form-control">
        				<option value="Зеленый" [[!+fi.roofColor:FormItIsSelected=`Зеленый`]] >Зеленый</option>
        				<option value="Коричневый" [[!+fi.roofColor:FormItIsSelected=`Коричневый`]] >Коричневый</option>
        				<option value="Красный" [[!+fi.roofColor:FormItIsSelected=`Красный`]] >Красный</option>
        				<option value="Серый" [[!+fi.roofColor:FormItIsSelected=`Серый`]] >Серый</option>
        			</select>
        		</label>
        		<label class="col-xs-12 col-md-6">
        			<span>Цвет внешнего покрытия</span>
        			<select name="surfaceColor" class="form-control">
        				<option value="Без покрытия" [[!+fi.surfaceColor:FormItIsSelected=`Без покрытия`]] >Без покрытия</option>
        				<option value="Дуб" [[!+fi.surfaceColor:FormItIsSelected=`Дуб`]] >Дуб</option>
        				<option value="Иней" [[!+fi.surfaceColor:FormItIsSelected=`Иней`]] >Иней</option>
        				<option value="Калужица" [[!+fi.surfaceColor:FormItIsSelected=`Калужица`]] >Калужица</option>
        				<option value="Махагон" [[!+fi.surfaceColor:FormItIsSelected=`Махагон`]] >Махагон</option>
        				<option value="Орегон" [[!+fi.surfaceColor:FormItIsSelected=`Орегон`]] >Орегон</option>
        			</select>
        		</label>
        	</div>
        	<div class="row">
        		<div class="col-xs-12 col-md-6 options">
        			<input type="checkbox" name="optOne" id="optOne" value="Отделка кедром" [[!+fi.optOne:FormItIsChecked=`Отделка кедром`]] >
        			<label for="optOne">Отделка кедром <span></span></label>
        		</div>
        		<div class="col-xs-12 col-md-6 options">
        			<input type="checkbox" name="optTwo" id="optTwo" value="Стеклянная дверь в парную" [[!+fi.optTwo:FormItIsChecked=`Стеклянная дверь в парную`]] >
        			<label for="optTwo">Стеклянная дверь в парную <span></span></label>
        		</div>
        		<div class="col-xs-12 col-md-6 options">
        			<input type="checkbox" name="optThree" id="optThree" value="Дополнительное утепление" [[!+fi.optThree:FormItIsChecked=`Дополнительное утепление`]] >
        			<label for="optThree">Дополнительное утепление <span></span></label>
        		</div>
        		<div class="col-xs-12 col-md-6 options">
        			<input type="checkbox" name="optFour" id="optFour" value="Электрика" [[!+fi.optFour:FormItIsChecked=`Электрика`]] >
        			<label for="optFour">Электрика <span></span></label>
        		</div>
        		<div class="col-xs-12 col-md-6 options">
        			<input type="checkbox" name="optFive" id="optFive" value="Дополнительное окно" [[!+fi.optFive:FormItIsChecked=`Дополнительное окно`]] >
        			<label for="optFive">Дополнительное окно <span></span></label>
        		</div>
        	</div>
        	<div class="buttons">
        		<button type="button" data-mfp-src="#configuratorPopup" class="btn btn-success btn-lg btn-block popup-call">заказать расчет</button>
        	</div>
        
        	<!-- Configurator popup -->
        	<div id="configuratorPopup" class="zoom-anim-dialog mfp-hide box popup">
        		<h2 class="text-uppercase text-center">Конфигуратор</h2>
        		<input type="text" name="buyerName" class="form-control" placeholder="Ваше имя" value="[[!+fi.buyerName]]">
        		<input type="text" name="buyerMail" class="form-control" placeholder="Ваш e-mail" value="[[!+fi.buyerMail]]">
        		<input type="tel" name="buyerPhone" class="form-control" placeholder="+7(___)-___-__-__" value="[[!+fi.buyerPhone]]">
        		<input type="submit" name="configuratorForm" class="btn btn-lg btn-block btn-success" value="отправить заявку">
        	</div>
        	<!-- /Configurator popup -->
        </form>
        



          • 17301
          • 932 Posts
          Thank you,

          That all looks fine to me. Can you post up your call and email chunk too? I'll give it a test on a dev environment.
            ■ email: [email protected] | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
            • 53148
            • 7 Posts
            Quote from: lkfranklin at Jun 23, 2017, 03:38 PM
            Can you post up your call and email chunk too?

            Sure. Here is the snippet call.
                  [[!FormIt?
                  	&emailTpl=``
                  	&hooks=`email`
                  	&submitVar=`configuratorForm`
                  	&validate=`buyerPhone:required`
                  	&emailTo=`[email protected]`
                  ]]
            


            I have no email template for now, but emails comes with an array of filled inputs, so the form is functioning.

            Thanks for your help.
              • 17301
              • 932 Posts
              You're missing

              method="post"

                ■ email: [email protected] | ■ website: https://alienbuild.uk

                The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                • 53148
                • 7 Posts
                Quote from: lkfranklin at Jun 23, 2017, 04:32 PM
                You're missing

                method="post"


                It's not the cause. FormIt automatically sets the method to post even if not set manually. I've set it already, no luck.
                I'm saying that the form really works, sends emails with SMTP, I receive them successfully, but only if submit button is outside the popup. Otherwise the form doesn't show any signs of life when clicking "submit", as it is not related to this form at all.
                  • 17301
                  • 932 Posts
                  Ok, well it works fine for me using the markup and call but only if I input the post method. Try inserting it onto a blank template and see if it also works for you, if it does then it must be a javascript issue.
                    ■ email: [email protected] | ■ website: https://alienbuild.uk

                    The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                    • 3749
                    • 24,544 Posts
                    I don't see why it wouldn't work the way you're doing it, but you could add an onClick() event to your button that would call a JS function that submits the form.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting