Author Topic: Mpform with smileys and emojis  (Read 152 times)

Offline netraam

  • Posts: 36
Mpform with smileys and emojis
« on: January 18, 2023, 09:41:39 PM »
Hello,

i'm using Mpform for several years. now I have version 1.3.22.
Tha last couple of years the people are using more and more smileys and emojis.
But when they send a form with a emojis Mpform can't save it to the database it just sends me an email.
Is there a simple solution for this? I dont mind if the smiley disapear I just want it to save the form in the database.

thanks in advance
Maarten

Offline sternchen8875

  • Posts: 176
Re: Mpform with smileys and emojis
« Reply #1 on: January 19, 2023, 01:08:47 AM »
what is the collation for the mpform-database-tables? Emoji's need utf8mb4. Maybe, thats the solution, but i've never use emoji's in a formular

Offline hgs

  • Betatester
  • **
  • Posts: 1728
    • EFG MG
Re: Mpform with smileys and emojis
« Reply #2 on: January 19, 2023, 07:35:22 AM »
The current version of mpForm is  1.3.43  and available for download here


But the current versions are also adapted to the current php version and the current WebsiteBaker Version
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

Offline Martin Hecht

  • Betatester
  • **
  • Posts: 608
  • Gender: Male
    • meine Homepage
Re: Mpform with smileys and emojis
« Reply #3 on: January 27, 2023, 10:20:45 PM »
Is the problem still there, when you swith to the latest version of mpform? Can it be solved by converting the database tables? (make a backup before running experiments...)

Offline netraam

  • Posts: 36
Re: Mpform with smileys and emojis
« Reply #4 on: February 07, 2023, 04:02:45 PM »
In the meantime i found a solution.
I've added a section to the page of the mpform.
The extra section is a code module where i've wrote a script that remove all Non-ASCII characters from my large textfield (in my case field #7).
The script is executed when you click on the send button.

Code: [Select]
echo "<script>
$('.mpform_submit').on('click', function () {
  removeInvalidChars();
});

function removeInvalidChars() {
  var str = $('#field7').val();
  str = str.replace(/[^\x20-\x7E]/g, '');
  $('#field7').val(str);
}
</script>";

 

postern-length