Form: Alerts (data-msg-required)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #10037990
    hidroxid
    Participant

    Hello

    Bearing in mind that the input fields can be assigned the property data-msg-required = “Error text” so that when trying to submit the form it is validated, is it possible to execute the alert associated to a particular field from code?

    It happens that I have specific validations for some fields and I am evaluating if I can activate an error message similar to the one that is executed when it has the data-msg-required property: the text in red under the field, the red box around it and to be removed when something is typed.

    Thanks!!



    Template Version: 8.3.0
    #10037994
    Support
    Keymaster

    Hello, here’s an example of that:

    <div class="form-group col-md-6 has-danger">
    	<label class="mb-1 text-2">Full Name</label>
    	<input type="text" value="" data-msg-required="Please enter your name." maxlength="100" class="form-control text-3 h-auto py-2 is-invalid" name="name" id="name" required="">
    	<label id="name-error" class="error" for="name">Please enter your name.</label>
    </div>

    Regards,

    Jonas


    #10037997
    hidroxid
    Participant

    Hello

    Yes, I have already learned from your examples about how to assign the attributes for automatic validation in the fields of a form, thanks any way.

    But, the question is:

    Can that validation be run from code?

    Something like: $(“#name”).ErrorActive() or $(“# name”).ShowValid()

    And additionally, how can I show other error information, with the same format that is shown when the validation is activated using the attribute data-msg-required = “Please enter your name.”

    My requirement is for the following:

    -Field 1 has the attribute data-msg-required = “Please enter your name.” which runs perfectly.
    -But, apart from that validation I have another one that I run via Ajax and check that the information exists.
    -If it does not exist, I would like to show it in the same space, the same font and with the same format (the red box around the field) but with another message, for example: The information was not found. I can even multiple different validations for the same field.

    I am looking to standardize the error messages.

    I hope they help me understand and help with these inventions 🙂

    Thank you.

    PS: Is it possible to add extra collaboration for you? I say this because I have received collaboration from you that exceeds what I have paid for your support and sincerely, I know that I am indebted to everything that you have helped me.


    #10038000
    Support
    Keymaster
    This reply has been marked as private.
    #10038005
    hidroxid
    Participant

    Hello

    The code works fine, thanks a lot, but when the input field is part of an input-group with input-group-append it doesn’t work as expected.

    Please see the pictures, before and after applying the style.

    Before: Before
    before

    After: After
    after

    Thanks!

    PS: You don’t accept crypto USDT? If it is negative, I will ask you to manage the payment via PayPal.


    #10038009
    hidroxid
    Participant

    Previously to this answer, i send you other answer related to a pay. Do you receive that?


    #10038012
    Support
    Keymaster
    This reply has been marked as private.
    #10038026
    hidroxid
    Participant

    Work perfect!

    Thanks!


Viewing 8 posts - 1 through 8 (of 8 total)

This topic is marked as "RESOLVED" and can not rceive new replies.