eMail validation in form filled from data tables

eMail validation in form filled from data tables

MartinLissJohanssonMartinLissJohansson Posts: 2Questions: 1Answers: 0
edited February 14 in Free community support

Hello,
I am chasing the answer everywhere.
I am building a form with datatables. It is very cool I click on a line in the datatable and the form fills automatically
So far soo good.
But If I want to be sure the email in the form is correct? or at least that it has a @ in it, the HTML5 doesn't work in the form, actually because there is no FORM as dataTables doesn't take FORM...

So How can I do?
I could send some code,

var eMail="";
function ut_chk_mail() {
    var eMail=$("#ut_t_email").val()

    var ut_chk_mail = /^[a-zA-Z0–9.!#$%&’*+\/=?^_`{|}~-]+@[a-zA-Z0–9](?:[a-zA-Z0–9-]{0,61} [a-zA-Z0–9])?(?:\.[a-zA-Z0–9](?:[a-zA-Z0–9-]{0,61}[a-zA-Z0–9])?)*$/;
if(ut_chk_mail.test(eMail))
     alert("Votre eMail semble correct");
else
     alert("Ce n'est pas un eMail, SVP valider encore.");
}

It actually gives the else alert no matter what I write and then it is added to the data base

Answers

  • colincolin Posts: 3,665Questions: 0Answers: 647

    Hi @MartinLissJohansson ,

    That sounds more like a generic Javascript question, rather than anything specific to DataTables. It would be worth asking on a site like StackOverflow.

    Cheers,

    Colin

  • MartinLissJohanssonMartinLissJohansson Posts: 2Questions: 1Answers: 0

    THX,
    I asked here because it is because using datatables the HTML 5 type="email" doesn't work...
    i will keep searching.
    Cheers Colin

  • allanallan Posts: 48,916Questions: 1Answers: 7,133 Site admin

    I don't really understand what using a table with type="email" means. Can you link to a page showing the issue please?

    Allan

Sign In or Register to comment.