address-validation is buggy?

  • Posts: 154
  • Thank you received: 4
11 years 7 months ago #67274

hello, i just noticed that if someone enters his address-details in login and / or billing / shipping address, if one required field is missing, then the input-field has a red border (styling of class .invalid), which is OK. but after entering some data into that field, and leaving another one empty, the new one gets of course the red border as well, but the old fixed one keeps its red border, even though now valid. i checked with firebug, and found out that the .invalid class does not get removed. is this a bug?

same happens also for the modals in "add new address"

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
11 years 7 months ago #67386

It's not a bug. It's just that we don't remove the invalid class.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
11 years 7 months ago #67390

?
excuse if i am not understanding this...

how am i supposed to style back to not-red-border when the field has been corrected?

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
11 years 7 months ago #67681

You need to modify the javascript code in the file media/com_hikashop/js/hikashop.js in order to remove the class from the elements.

Replace the line:
if(!isValid){

by:
if(isValid){
elementToCheck.className.replace( /(?:^|\s)invalid(?!\S)/g , '' );
}

in that file and that should do it once you clear your browser's cache.

The following user(s) said Thank You: olivnewton

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
11 years 7 months ago #67701

thanks for the tip!
unfortunately your replacement wouldnt work...

this works though:

if(isValid){
	elementToCheck.removeClass('invalid');
} else {

no offense, but:
you should definitely include this in the next update!
its like buying a BMW, and the low-full-alert appears on the controls-screen.
after refueling, its still red, you call BMW-Service and they tell you how to fix it yourself... ;-)

but: great, fast support, as usual!!!
thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
11 years 7 months ago #67737

removeClass won't work without jquery.
Your modification can't be included.

Try like that then :
if(isValid){
elementToCheck.className.replace(new RegExp('(\\s|^)invalid(\\s|$)'),' ').replace(/^\s+|\s+$/g, '');
}

The modification will be included if we can validate it.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
11 years 7 months ago #67744

...but it will work with mootools, and mootools is joomla standard enabled

your solution does not work for me:
".invalid" does not get removed!

i keep adding the " else {" otherwise it wouldn work at all, i hope this is correct

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
11 years 7 months ago #67905

We put some other more complex code and properly tested it on our end.

It will be added in next version.
In the mean time you can use your solution.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
11 years 7 months ago #68044

i see. ok.

Please Log in or Create an account to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum