WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: SteveFitz1 on January 11, 2022, 06:57:00 PM

Title: ContactLP Form Question
Post by: SteveFitz1 on January 11, 2022, 06:57:00 PM
Ken,

I tried implementing the ContactLP Form today and was successful. However, I noticed that the "blocks" in the form do not align horizontally. It appears the blank "blocks" are aligned higher than the "blocks" containing numbers. When I look at the contact page at Saratog-Weather.org, I see the same thing with mis-aligned "blocks". However, when I look at the screenshots on the ContactLP Form page in your script section, all the blocks on a row appear to be level. Did something in the code change between the time you took the screenshots and the current iteration of the code?

Thanks,

Steve
Title: Re: ContactLP Form Question
Post by: saratogaWX on January 12, 2022, 12:02:12 PM
Very odd.. it seems to be a browser-specific issue.

On Firefox, and SeaMonkey on Windows 10, it all looks like what is shown in the script page and the GitHub distribution (4 button rows.
On Chrome, Brave, Edge, Opera on Windows 10, it has the 4-button rows, but the 'empty' buttons are jogged up a bit compared to the buttons with numbers.

On an iPad or iPhone, Safari, Chrome, Firefox all show the two button-narrow column instead of the 4 button wide pad.

Looks like I need to do some CSS tweaking to have it look the same on all browsers.
Title: Re: ContactLP Form Question
Post by: SteveFitz1 on January 12, 2022, 12:22:13 PM
Hey Ken,

Glad to know it wasn't something I did wrong, but sorry to dump more work on your always-full plate.

Thanks very much.

Steve
Title: Re: ContactLP Form Question
Post by: saratogaWX on January 13, 2022, 01:19:36 PM
Wow, that took a lot of exploring to fixup the CSS for the pad display so it looks mostly the same on all browsers.

V4.02 is now available, and the main change is to the CSS in contactLP.php/contactLP-inc.php.

Available on the script page (https://saratoga-weather.org/scripts-contactLP.php#contactlp) or on GitHub distribution (https://github.com/ktrue/contact-form-loginpad)

I've tried it with Firefox, Google Chrome, Opera, Brave, SeaMonkey, Edge and IE11(yech!) on Windows 10, and on Safari on iPad/iPhone (iOS 15.2).  I don't have a working Mac to test with Safari on MacOS (sorry).
Title: Re: ContactLP Form Question
Post by: SteveFitz1 on January 13, 2022, 05:32:00 PM
Got the update installed and it looks much better. Thanks for your work.

Steve
Title: Re: ContactLP Form Question
Post by: mexbound on January 15, 2022, 09:09:28 AM
One issue I found (not with the new update) in contactLP-inc.php, is in the function "validate_email". An email address that contains a "dash" would not validate even though it is a valid email address.  example: joe@joe-sam.com.   To get around it I just forced the $valid flag to 1 at the end of the function. I don't know enough about PHP to correctly fix the function to allow "dash".
Title: Re: ContactLP Form Question
Post by: saratogaWX on January 17, 2022, 07:12:17 PM
I've done an update to contactLP-inc.php V4.03 to better handle those type of email addresses.  It now handles emails with - or . in the name or in the hostname.

Updated on the script page (https://saratoga-weather.org/scripts-contactLP.php#contactlp) and the GitHub distribution (https://github.com/ktrue/contact-form-loginpad)

I tried a bunch of different regex mods, and this one seemed to be the best one in testing.  Here's the results on various email addresses:

Code: [Select]
Valid email: 'm-0-o.bfe-nfk@s-ugd-og.gg-gm-ain.com.pl'

Valid email: 'wfff-ef-ff.mi-ki.fi-ki.miki@dns1-su-ddd.o-ma.in.dom-ain.tech'

Valid email: 'max-io.be-nko@sub-dom-ain.dom-ain.com.tv'

Valid email: 'webmaster@some-weather.org'

NOT VALID email: 'Jean-François+@anydomain.museum'

Valid email: 'Jean-Francois+@anydomain.museum'

Valid email: 'joe@joe-sam.com'

The original regex had these results
Code: [Select]
Valid email: 'm-0-o.bfe-nfk@s-ugd-og.gg-gm-ain.com.pl'

Valid email: 'wfff-ef-ff.mi-ki.fi-ki.miki@dns1-su-ddd.o-ma.in.dom-ain.tech'

Valid email: 'max-io.be-nko@sub-dom-ain.dom-ain.com.tv'

Valid email: 'webmaster@some-weather.org'

NOT VALID email: 'Jean-François+@anydomain.museum'

NOT VALID email: 'Jean-Francois+@anydomain.museum'

Valid email: 'joe@joe-sam.com'

Title: Re: ContactLP Form Question
Post by: mexbound on January 18, 2022, 08:36:03 AM
Thanks for the update. Works perfect!