Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6893273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:38:18+00:00 2026-05-27T06:38:18+00:00

In form validation, on blur, a data validation gets triggered. IN this form, I

  • 0

In form validation, on blur, a data validation gets triggered. IN this form, I have 3 different onblur possible triggers. But if one triggers, I get two alert boxes, which means, two funcitons were triggered.

The form (html code):

<form id="processpayment" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<table class="paypal">
<tbody>
<tr>
<td class="etiqueta" width="50%"><label>Nombre</label></td>
</tr>
<tr>
<td><input id="nombre" class="requerido" type="text" name="nombre" value="" /></td>
</tr>
<tr>
<td class="etiqueta"><label>Forma de comunicación</label></td>
</tr>
<tr>
<td><span id="medio" class="requerido">Skype</span></td>
</tr>
<tr>
<td class="etiqueta"><label id="label_medio_id">Usuario de Skype</label></td>
</tr>
<tr>
<td><input id="medio_id" class="requerido" type="text" name="medio_id" value="" /></td>
</tr>
<tr>
<td class="etiqueta"><label id="confirm:label_medio_id">Verifica usuario de Skype </label></td>
</tr>
<tr>
<td><input id="confirm:medio_id" class="requerido" onblur="confirm_data(this.id);" type="text" name="confirm:medio_id" value="" /></td>
</tr>
<tr>
<td class="checkbox" colspan="2"><input id="warningpaypalverified" class="requerido" type="checkbox" name="warningpaypalverified" value="payment constraints acknowledged" /><label class="alerta">Pagos de tarjeta de crédito son procesados inmediatamente.<br /><br /> En caso de que use su cuenta PayPal, es necesario ser verificado por PayPal con anterioridad.<br /><a id="explain" class="explain" onclick="explain('La conversación inmediata tiene como característica el comunicarse con alguien inmediatamente.\n\nCuando PayPal no ha verificado su cuenta estos pagos toman mas de 24 horas.\n\nSi desea una conversación inmediata, pague con tarjeta de crédito.')">Por que es esto necesario</a></label></td>
</tr>
<tr>
<td id="paypal" colspan="2"><input type="hidden" name="notify_url" value="http://root.com/process/listener.php" /> <input type="hidden" name="locale.x" value="es_XC" /> <input class="alldata" type="hidden" name="custom" value="" /> <input type="hidden" name="cmd" value="_s-xclick" /> <input type="hidden" name="image_url" value="http://root.com/images/root_logo.png" /> <input type="hidden" name="hosted_button_id" value="THISANDTHAT" /> <input class="paypal" type="image" name="submit" src="https://www.paymentobjects.com/es_XC/i/btn/btn_buynowCC_LG.gif" alt="PayPal, la forma más segura y rápida de pagar en línea." /> <img src="https://www.paymentobjects.com/es_XC/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /></td>
</tr>
</tbody>
</table>
</form>

I have following javascript code:

function clear_fields(fieldid, confirm_fieldid){
        document.getElementById(fieldid).value = "";
        if (typeof(confirm_fieldid) !== 'undefined'){ document.getElementById(confirm_fieldid).value = ""; }
        document.getElementById(fieldid).focus();
        return false; 
    }

function validate_email(email_field_id){

        email = typeof(email_field_id) != 'undefined' ? document.getElementById(email_field_id) : function(){alert('Parameter error when calling Validate Email. Check your form'); return;}();

        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

        if( reg.test(email.value) == false ) {

            alert('El email que ingresaste no es correcto. Por favor, intenta nuevamente siguiendo este formato tucorreo@ejemplo.com');

            return clear_fields(email_field_id);

        } else { return true; }

    }

function confirm_email( confirm_email_field_id ){

        var confirmemail = typeof(confirm_email_field_id) != 'undefined' ? document.getElementById(confirm_email_field_id) : function(){alert('Parameter error when calling javascript function confirm_email(). Check your form, and make sure input field for confirm email calls the function confirm_email("confirm:email_id");'); return;}();

        var confirmemailarray = confirmemail.id.split(':'); 

        var email = document.getElementById(confirmemailarray[1]);

        if( email.value === confirmemail.value ) {    

            return true;

        } else { 

            alert("ERROR: \"Email\" no coincide con \"Confirmar Email\". \n Agrega tu \"Email\" y CONFIRMA este Email")

            return clear_fields(email.id, confirmemail.id);

        }

    }

function confirm_data(confirm_data_field_id){

        if( typeof(confirm_data_field_id) == 'undefined'){

            alert('Parameter error when calling javascript function confirm_data. Check your form, and make sure input field to confirm data calls the function confirm_data("confirm:data_field_id");'); 

            return;

        } else {

            var confirmidarray = confirm_data_field_id.split(':'); 

            thedata = document.getElementById(confirmidarray[1]);

            confirmthedata = document.getElementById(confirm_data_field_id);

            if( thedata.value == confirmthedata.value ) return true;
            else {

                thedatalabel = document.getElementById('label_' + thedata.id);
                confirmthedatalabel = document.getElementById('confirm:label_' + thedata.id);

                alert('ERROR: Los datos que ha ingresado en los campos de informacion \n\n' + thedatalabel.innerHTML + '\n' + confirmthedatalabel.innerHTML + '\n\n NO COINCIDEN. \n\n Para proceder con su pago agregue la informacion correcta.' );

                return clear_fields( confirmidarray[1], confirmidarray[0] + ':' + confirmidarray[1] );

            }

        }

    }

Why is this happening?

What changes do I need to do?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:38:18+00:00Added an answer on May 27, 2026 at 6:38 am

    In some browsers, an alert() can trigger focus events (because focus goes to the alert box and then back to the page afterwards). When debugging this kind of issue, it’s better to use console.log() which doesn’t mess with focus to record what’s going on and you can then just look at the log to see what really happened without having changed the behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using $.blur(fn();) for form validation, but this only takes effect when
I have coded custom form validation. validation is working fine all browser but when
Form validation for check boxes only seems to be working in IE....? Anyone have
I have created an form validation using ajax/php. Each text box is validated using
This is a form validation that will hide the submit button if the input
I am using jquery validation plugin for form validation. I have added a custom
I knew there is a JQuery form validation, but if there is no form,
I have a user registration form. I am doing server side validation on the
I have some JQuery form validation where im checking the length of the username
Server side extjs form validation using zend framework I have extended Zend_Form class to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.