This topic is locked
[SOLVED]

verifie email with double -entry

12/4/2025 03:51:02
PHPRunner General questions
ffrinai author

Hi,
I'd like to check in the add page for adding a double-entry email field without having to enter two fields in the table.
I've searched extensively and haven't found a way.
Do you have any suggestions?
Thanks.
Fabio

ChatGPT 12/4/2025

Hi Fabio,

In PHPRunner, if you want to implement a double-entry email field on the add page without adding a second email column to your database table, you can achieve this by using JavaScript for client-side validation. Here’s a step-by-step approach to do this:

  1. Add a single email field to your form: In the PHPRunner interface, ensure that you have only one email field added to the form.


  2. Add a second email input field for confirmation: You can add a new text field to your form for email confirmation. This field will not be bound to any database column. You can simply use a regular text field and label it as "Confirm Email".


  3. Use JavaScript for validation: You can add custom JavaScript to validate that both email fields match before submitting the form. To do this:

    • Go to the "Events" section in PHPRunner.
    • Choose the "Before Record Added" event or "Before Display" event, depending on how you want the validation to occur.
    • Add JavaScript code to compare the two email fields. Here's an example of what the code might look like:

    $(document).ready(function() {
    $("#yourConfirmEmailFieldID").on('input', function() {
    var email = $("#yourEmailFieldID").val();
    var confirmEmail = $(this).val();
    if (email !== confirmEmail) {
    $("#emailMismatchMessage").show(); // Show a message if they don't match
    } else {
    $("#emailMismatchMessage").hide(); // Hide the message if they match
    }
    });
    });

    Make sure to replace yourConfirmEmailFieldID and yourEmailFieldID with the actual IDs of your email fields.


  4. Display a mismatch message: You can add a <div> or <span> element to your form to display a message when the emails do not match. For example:

    <div id="emailMismatchMessage" style="color: red; display: none;">
    Email addresses do not match.
    </div>

  5. Prevent form submission: To prevent the form from being submitted if the emails do not match, you can use the onsubmit event of the form:

    $("form").on('submit', function(e) {
    if ($("#yourEmailFieldID").val() !== $("#yourConfirmEmailFieldID").val()) {
    e.preventDefault(); // Prevent form submission
    alert("Please ensure that the email addresses match.");
    }
    });


By following these steps, you can have a double-entry email field on your add page without requiring an additional column in your database. This approach allows you to validate the email addresses while keeping your database schema clean.

If you have any further questions or need clarification on any of these steps, feel free to ask!

Best,
[Your Name]

ffrinai author 12/4/2025

how Add a second email input field for confirmation?

ffrinai author 12/4/2025

I solved with the insertion in query designer.

recapitoRispostaRichiesta as ConfermaEmail,

Then test in field events of ConfermaEmail:
params["confirm"] = this.getValue();
var ctrlrecapito = ctrl.getPeer("recapitoRispostaRichiesta");
params["recapito"]=ctrlrecapito.getValue();

if (params["confirm"] !== params["recapito"]){
swal({
title: "Attention!!!",
text: "The Delivery and Confirmation email addresses do not match (8.1)",
icon: "error",
button: "Ok",
});
}
return false;

Fabio