Modx Formit simple contact from

随声附和 提交于 2020-02-06 09:20:53

问题


I try to create a simple contact form, but I didn't get any message, the post request is made. I am pretty new with Modx.

What I tried:

Link 1

Link 2

I created 2 Chunks (emailChunkTpl and MyEmailChunk), and in my template I call for the [[$MyEmailChunk]]. Obviously I did something wrong but I am not sure what. The code is like in the examples, but with some changes,like my email.

[[!FormIt?
   &hooks=`email,FormItSaveForm `
   &emailTpl=`emailChunkTpl`
   &emailTo=`myEmail@gmail.com`
   &emailUseFieldForSubject=`1`
]]      

                    <form action="[[~[[*id]]]]" method="post" class="contactForm">
                        <div class="row input-section-child">
                            <div class="col input-contact">
                                <input value="[[!+fi.input-name]]"class="input-name" name="input-name" id="input-name" type="text" placeholder="your name" />
                                <input value="[[!+fi.input-email]]" class="input-email" name="input-email" id="input-email" type="text" placeholder="email address" />
                            </div>
                            <div class="col input-contact-text">
                                <input value="[[!+fi.input-textare]]"class="input-textare" name="input-textare"  id="input-textare" type="textare" placeholder="message" />
                            </div>
                        </div>
                            <div class="row second-row">
                                <div class="col checkbox">  
                                    <input value="[[!+fi.input-checkbox]]" class="input-checkbox" name="input-checkbox" id="input-checkbox" type="checkbox" ><span class="input-checkbox-span">I agree to the Privacy policy.</span>
                                </div>
                                <div class="col">
                                    <button type="submit" class="send-button">SEND</button>
                                </div>
                            </div>
                            <a href="#intro" class="back-to-top"><img src="images\arrow-back.svg" /><span>Back to top</span>
                        </div>
                    </from>

回答1:


You should start with cleaning up your markup, it is not valid HTML. There is a typo in your closing form tag (/from), an extra closing div tag, there is no input type of textare as far as I know, and you are missing white space around some classes. You can validate HTML here: https://validator.w3.org/

You can test to make sure your site is setup properly to send an email. There is a snippet for this called QuickEmail, download it from the extras tab in the MODX manager.

Once you're sure your site can send email, then start with a stripped down version of the Formit call -- remove all hooks except email and get it working with that first. Then add hooks one at a time.



来源:https://stackoverflow.com/questions/59981179/modx-formit-simple-contact-from

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!