Forums / Bug Reports / [Done v1.3.9c] javascript validation of edit account form

[Done v1.3.9c] javascript validation of edit account form

Locked

Views: 4,453

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
2 May 2010, 5:04 PM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

[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

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

3 May 2010, 6:33 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done v1.3.9c] 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?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 May 2010, 4:31 PM
#3
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: [Done v1.3.9c] 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 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

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

3 May 2010, 5:47 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done v1.3.9c] javascript validation of edit account form

It's safe to delete that line.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 May 2010, 5:57 PM
#5
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: [Done v1.3.9c] 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

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

3 May 2010, 6:34 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done v1.3.9c] 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.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 May 2010, 11:41 PM
#7
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: [Done v1.3.9c] 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:


Zen Cart and it's community are the best!!

3 May 2010, 11:43 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done v1.3.9c] javascript validation of edit account form

You can fix it by simply deleting the line we discussed above from the filename mentioned.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

3 May 2010, 11:53 PM
#9
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: [Done v1.3.9c] 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!!


Zen Cart and it's community are the best!!

4 May 2010, 12:12 AM
#10
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: [Done v1.3.9c] javascript validation of edit account form

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


Zen Cart and it's community are the best!!

4 May 2010, 12:23 AM
#11
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: [Done v1.3.9c] javascript validation of edit account form

lankeeyankee:

/includes/modules/pages/no_account/jscript_form_check.php
Sorry, forget that last one since it's from an add-on module.:blush:


Zen Cart and it's community are the best!!

4 May 2010, 12:31 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done v1.3.9c] javascript validation of edit account form

No, you should only touch the filename originally mentioned.
If you touch the others, you'll end up without form validation happening.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 May 2010, 5:07 AM
#13
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: [Done v1.3.9c] javascript validation of edit account form

Oh right. Sorry, I misunderstood what you said in a previous post about the missing quotes showing up in other pages too and assumed that they were affected as well. Thanks for setting me straight!!:blush::shocking::D


Zen Cart and it's community are the best!!

4 May 2010, 9:47 AM
#14
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: [Done v1.3.9c] javascript validation of edit account form

thanks for that. A real bug for once! makes a change (for me) from only finding validation errors.

Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...