[Done v1.3.9c] javascript validation of edit account form
v.139b - vanilla
It appears that the javascript validation is not working on edit account as I never see the popup error messages, only the php ones. The code on create account works.
I see there is new code in there with a keyword of optional, so is there something I should be switching on somewhere?
Steve
Re: javascript validation of edit account form
I just tested it on a fresh v1.3.9b install, and I get the javascript popups on appropriate fields when using main_page=account_edit
Maybe you're missing some files from your server?
Re: javascript validation of edit account form
I knew you would say that..
This is a local install (xampp 173, php5.3) done specifically to look at this problem I found with my dev shop so it has no mods whatsoever.
This error occurs without even going into the admin once to change anything.
Anyway after a lot of breakpointing I find that this snippet in
\includes\modules\pages\account_edit\jscript_form_check.php
is responsible for the whole error-checking routine popping out of sequence.
PHP Code:
<?php if (ACCOUNT_STATE == 'true') echo ' if (!form.state.disabled && form.zone_id.value == "") check_input("state", ' . (int)ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '")' . "\n" . ' else if (form.state.disabled) check_select("zone_id", "", "' . ENTRY_STATE_ERROR_SELECT . '");' . "\n"; ?>
If I delete this, everything works correctly.
I note that in 138a this snippet of code is not in the edit account javascript whereas in 139 the jscript code is identical between create account and edit account.
I get this error in FF, IE, Opera, Chrome.
Create Account and Create Account split login work ok.
Steve
Re: javascript validation of edit account form
It's safe to delete that line.
Re: javascript validation of edit account form
weeeel yes, I agree it does not do anything in this context but I just can't help having to know why I am the only one with this issue...
or why the code is there is the first place..
thanks
Steve
Re: javascript validation of edit account form
Actually, you're not the only one having this "issue". I did some further testing and replicated the problem myself.
1. The real problem is that the form field names didn't have quotes put around them in the tests. That'll be fixed in a newer version.
2. The javascript bug doesn't prevent proper form validation. It merely makes the user wait a moment longer for the display of an error message if one exists.
As to your "why the code is there in the first place" question,
3. The javascript file was updated because of a number of people complaining that it didn't do proper validation if min-length was set to 0 or blank on some forms. And, since the same validation javascript is used in multiple pages, the update was applied to all pages, so that the files are consistent. Unfortunately the missing quotes got copied to all pages too.
So, yes, it's a bug. A tiny fairly inconsequential one, but a bug nonetheless.
Re: [Done] javascript validation of edit account form
Could you please post the correct fix for this bug? I am keeping track of all new bugs in 1.3.9b to correct them as soon as they are identified to keep the code as bug free as possible. I have 13 new sites I am developing over the next couple of months.
Thanks! And thanks again for the great software!!!:hug:
Re: [Done] javascript validation of edit account form
You can fix it by simply deleting the line we discussed above from the filename mentioned.
Re: [Done] javascript validation of edit account form
OK, I thought it would be best to add the quotes around the form field names to preserve the original code but if deleting that line doesn't affect functionality I will do that instead. Do you know what other files(if any) are affected by the same bug? Thanks DB!!
Re: [Done] javascript validation of edit account form
Quote:
Originally Posted by
lankeeyankee
Do you know what other files(if any) are affected by the same bug?
Using the trusty ol' developer's toolkit(what a great tool btw!!!) this is the list of affected files that I can determine:
/includes/modules/pages/address_book_process/jscript_main.php
/includes/modules/pages/checkout_payment_address/jscript_main.php
/includes/modules/pages/checkout_shipping_address/jscript_main.php
/includes/modules/pages/create_account/jscript_form_check.php
/includes/modules/pages/login/jscript_form_check.php
/includes/modules/pages/no_account/jscript_form_check.php