V
V
Vadim Yagofarov2019-01-30 17:02:35
MODX
Vadim Yagofarov, 2019-01-30 17:02:35

Mail not coming through custom form in modx?

Here is the standard ajaxform chunk

<form action=""  method="post" class="ajax_form af_example">
                                <div class="form-group">
                                    <input type="text" class="form-control" placeholder="Имя" name="name" id="af_name">
                                    
                                </div>
                                <div class="form-group">
                                    <input type="tel" class="form-control" placeholder="Телефон" name="phone" id="af_phone">
                                </div>
                                <div class="form-group">
                                    <button type="submit" class="btn form__btn">af_submit</button><br>
                                </div>
                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" id="exampleCheck1" required>
                                    <label class="form-check-label" for="exampleCheck1">Даю согласие на обработку персональных данных</label>
                                </div>
                                
                            
                            </form>

and here is my chunk
<form action=""  method="post" class="ajax_form af_example">
                                <div class="form-group">
                                    <input type="text" class="form-control" placeholder="Имя" name="name" id="af_name">
                                    
                                </div>
                                <div class="form-group">
                                    <input type="tel" class="form-control" placeholder="Телефон" name="phone" id="af_phone">
                                </div>
                                <div class="form-group">
                                    <button type="submit" class="btn form__btn">af_submit</button><br>
                                </div>
                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" id="exampleCheck1" required>
                                    <label class="form-check-label" for="exampleCheck1">Даю согласие на обработку персональных данных</label>
                                </div>
                                
                            </form>
                            
                            

Call like this

and the mail does not come, but when I drive in &form=`tpl.AjaxForm.example` instead of &form=`form-main`, then everything comes fine. I checked a hundred times and I do not know where the mistake is made. For the sake of checking whether there is a binding to the names of the chunk, I copied my form to the place tpl.AjaxForm.example and the mail stopped coming. Please tell me what is wrong

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Lunegov, 2019-01-30
@GIRUPC

Here is this line

&validate=`name:minLength=^2^,email:email:required,message:minLength=^10^`
we read like this: “The name="name" field must be filled in and at least two characters, the name="email" field must be filled in, and according to the rules of email addresses, the name="message" field must contain at least 10 characters. Therefore, if you remove the message
fields , and even more so the email fields , then you need to exclude them from the check in the snippet call. And I hope this post makes sense to you.
action=""

F
Froggyweb, 2019-01-30
@Froggyweb

standard looks like this

<form action="" method="post" class="ajax_form af_example">

    <div class="form-group">
        <label class="control-label" for="af_name">af_label_name</label>
        <div class="controls">
            <input type="text" id="af_name" name="name" value="" placeholder="" class="form-control"/>
            <span class="error_name"></span>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label" for="af_email">af_label_email</label>
        <div class="controls">
            <input type="email" id="af_email" name="email" value="" placeholder="" class="form-control"/>
            <span class="error_email"></span>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label" for="af_message">af_label_message</label>
        <div class="controls">
            <textarea id="af_message" name="message" class="form-control" rows="5"></textarea>
            <span class="error_message"></span>
        </div>
    </div>

    <div class="form-group">
        <div class="controls">
            <button type="reset" class="btn btn-default">af_reset</button>
            <button type="submit" class="btn btn-primary">af_submit</button>
        </div>
    </div>

    
    
</form>

At you the form empty here also does not reach anything.
Add placeholders to inputs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question