Error js messages

Home Forums Quform WordPress Error js messages

This topic is: resolved
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #32872
    oivanr
    Participant

    Hi,
    I have three questions about this:
    1) I want help to clear messages in the form.
    Since I have some validations, I display errors with
    form.addElementError(‘xx_xx’, ‘message’).quformShowSlide();
    What I want is to clear the messages when the conditions of the validation are correct.
    2) I want to send a message but not for a specific field. Messages like send the WP when for example an user type and unknown user name.
    3) How I can translate the WP messages to spanish?
    Thanks in advance,

    #32880
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #32886
    oivanr
    Participant

    Hi,
    This is the code that I am using to validate
    Line 4 prepare the var to display the message in lines 29 – 30
    Lines 15 – 30 call ajax, go to php function and return a value, depending on that I display the message. Works fine
    Line 6 – 8 include the code you gave me
    Line 31 I try to clear the message, but is not working
    The difference between this and the example you gave me is the ajax call
    Can you help me?

    1jQuery(function materiasAsignadas_Fecha($) { // formulario de tarea – busca si la sección materia ya 2)tiene prueba asignada ese día
    3) $(‘.quform-field-35_35’).change(function () {
    4 // para presentar / eliminar errores
    5 var form = $(‘.quform-form-35’).data(‘quform’);
    6 var $field = $(‘.quform-field-35_9’),
    7 materia = $(‘.quform-field-35_9’).val(),
    8 $element = $field.closest(‘.quform-element’);
    9
    10
    11 var accion = ‘materiaTareaFechaAsignada’;

    12 var fecha = $(‘.quform-field-35_35’).val();
    13 $(‘.quform-field-35_48’).val($(‘.quform-field-35_35’).val());
    14
    15 jQuery.ajax({
    16 type: ‘post’,
    17 url: ajax_var.url,
    18 datatype: ‘json’,
    19 data: {
    20 action: accion,
    21 security:ajax_var.nonce,
    22 materia:materia,
    23 fecha:fecha
    24 },
    25 success: function(salida){
    26 // lo que se recibe de PHP
    27 var original = salida.trim();
    28 if (original > 0){ // envío el mensaje de que ya existe
    29 form.addElementError(’35_9′, ‘Esta materia ya tiene tarea/prueba en esta
    30 fecha’).quformShowSlide();
    31 } else {$element.removeClass(‘quform-has-error’).find(‘.quform-error’).remove();}
    32 }
    33 });
    34 });
    35 });

    #32889
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33970
    oivanr
    Participant

    Ally,
    Your code works fine, but is there any way to clean all messages in a screen just once? I mean not to clean field messages individually?
    Thanks for your valuable help.
    Regards,
    Omar

    #33976
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33982
    oivanr
    Participant

    Excellent!!! Thanks a lot. That code works fine!!
    Thanks
    Omar

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy