PHP Classes

PHP Login Pad Class - form reset

Recommend this page to a friend!

      PHP Login Pad Class  >  All threads  >  PHP Login Pad Class - form reset  >  (Un) Subscribe thread alerts  
Subject:PHP Login Pad Class - form reset
Summary:Also reset the entered code
Messages:7
Author:Peter
Date:2021-01-28 02:52:17
 

  1. PHP Login Pad Class - form reset   Reply   Report abuse  
Picture of Peter Peter - 2021-01-28 02:52:18
Hi,
Awesome class -- very useful!

I found that while the form reset, any previous digits entered did not get reset and when the user typed in the new code, it got appended to what had previously been cleared.

I added an 'onReset()' function to this line:
--------------------------
echo "<form name='keypad' method='post' action='".$_SERVER["PHP_SELF"]."' onReset='updateForm();'>";
--------------------------

And added this function:
--------------------------
echo "function updateForm()\n";
echo "{\n";
echo " code = '';\n";
echo "}\n";
--------------------------

I'm not sure if this was the right thing to do but it seems to work.

Peter.

  2. Re: PHP Login Pad Class - form reset   Reply   Report abuse  
Picture of Pierre FAUQUE Pierre FAUQUE - 2021-01-28 14:07:23 - In reply to message 1 from Peter
Thanks Peter for your interest in this PHP class.

Can you STP send me this class that you modified to heliconius@fauque.net?

It's probably an idea but I haven't come across the case yet. When you validate (on the [Send] button) it's the $_SERVER["PHP_SELF"] page (therefore, itself) which processes the entry. The page is therefore reloaded and the javascript located outside the "function xxxx() {...}" blocks is executed, the first instruction being : var code = ''; so, the entered code is reset to empty.
But maybe a cache issue or a bad refresh page is causing what you've seen. I would like to see overall how you solved this problem. Once again, thank you.

Where are you from ? Me, Paris, France.

  3. Re: PHP Login Pad Class - form reset   Reply   Report abuse  
Picture of Peter Peter - 2021-01-29 03:28:16 - In reply to message 2 from Pierre FAUQUE
Bonsoir Pierre,
I'm located in Ottawa, Canada.

>> When you validate [...] the page is [...] reloaded

Yes, true. However, the case am identifying is when the page is not submitted for validation but, rather, the user clicks the "clear" button on the form. The expectation is that the code is cleared (reset to no digits entered) but it actually retains its value in the code variable.

Try it on your demo site:
fauque.fr/demos/phpclasses/loginpad ...

Enter: 1708 [clear] 1936 [send]
This will result in a code of "17081936" being submitted when you click the submit button when it should only have sent "1936".

>> Can you STP send me this class

Sorry, I'm not familiar with the acronym STP (?)
I made a few other changes to the class to meet my specific needs but the changes I made specific to this issue were included in my last message if that helps.

Thanks again for the excellent class.

Peter.

  4. Re: PHP Login Pad Class - form reset   Reply   Report abuse  
Picture of Pierre FAUQUE Pierre FAUQUE - 2021-01-29 17:10:42 - In reply to message 3 from Peter
Thank you very much for your error report. I've Uploaded a new version based on your report (I didn't know : onreset="...").

A little explication about STP :-)

In english you always use YOU while in French we distinguish the singular, the plural, by politeness, by familitarity.
Examples (always familiarity singular) :
TU manges (YOU eat)
je TE donne (I give YOU)
c'est TOI (it's YOU)
-- French : TU-TE-TOI
-- English : YOU-YOU-YOU

Examples (either plural or singular by politeness) :
VOUS mangez (YOU eat)
je VOUS donne (I give YOU)
c'est VOUS (it's YOU)
-- French : VOUS-VOUS-VOUS
-- English: YOU-YOU-YOU

Acronyms :
-- STP : S'il TE Plaît (contraction of "si [cela] TE plait", litterally "if YOU like it", in real : please), always said to one person by familiarity
-- SVP : S'il VOUS Plaît (contraction of "si [cela] VOUS plait", litterally "if YOU like it", in real : please), said to several people or to a person by politeness

Yes, we are complicated, I know... but I think it's more precise (for us) :-)

Hello from Paris and thanks for your report,
Pierre

  5. Re: PHP Login Pad Class - form reset   Reply   Report abuse  
Picture of Peter Peter - 2021-01-30 01:17:22 - In reply to message 4 from Pierre FAUQUE
Mais oui,
Moi, je connais "SVP" mais c'est la premiere fois que j'ai vu "STP". D'accord, maintenant j'ai compris!

Je parle seulment assez de francais de commander deux bieres -- la phrase le plus important du monde dans chaque langue. :o)

Bonne journee et merci pour la PHP class excellent.
P.

  6. Re: PHP Login Pad Class - form reset   Reply   Report abuse  
Picture of Peter Peter - 2021-01-30 01:18:55 - In reply to message 5 from Peter
... also I thought STP was some form of FTP and I was wondering how I could FTP you a document via email... :o)

  7. Re: PHP Login Pad Class - form reset   Reply   Report abuse  
Picture of Pierre FAUQUE Pierre FAUQUE - 2021-02-01 18:14:28 - In reply to message 5 from Peter
Just say: I would like two beers please (SVP) is already a great start :-)
Have a nice day and thank you for this exchange...