Validation controls on form

  • Posts: 84
  • Thank you received: 0
12 years 6 months ago #50610

Hi,

Is it possible to add numeric validation to forms in hikashop. Or is there any other way to add more validation outside of fields? Minimum length, numeric only, valid email or similar ideas? Thanks for any leads!

kind regards,

Luke

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
12 years 6 months ago #50683

There is no option but it's possible if you add some javascript validation code in the view displaying the form of the custom field where you want that.
The view to be edited will depend on the custom field "table". On which kind of custom fields do you want to do that ?

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

  • Posts: 84
  • Thank you received: 0
12 years 6 months ago #50696

Hi Nicholas,

I would like to try to add some validation for

- valid email adresse
- telephone (numeric only and length validation eg xxxxxxxxxx 10 numbers min and max....
-a customer code (numeric only and length validation eg xxxxxx 6 numbers min and max....

The last two are essentially the same and could be used for validating any numeric value such as code postal or account etc....

Of course I have already accomplished the max values through default options :)

Thanks for any more advice!

Luke

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
12 years 6 months ago #50754

There is already a check on the validity of the email address and the telephone number on the registration form of HikaShop.
Are you talking about a different place ?

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

  • Posts: 84
  • Thank you received: 0
12 years 6 months ago #50907

Hi Nicolas,

I am referring to fields I have added into my adresse table, since no registration is required.

kindly,

Luke

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
12 years 6 months ago #51054

Then, you will have to add your javascript code in the file "custom_fields" of the view "user" of the front end via the menu Display->Views, just before the javascript call to hikashopToggleFields.

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

  • Posts: 267
  • Thank you received: 5
8 years 8 months ago #231894

Hi there
How could modify the validation of username on the registration form ?

thanks

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 8 months ago #231898

Hi,

Theere is no system to add checks to the username field. It would require custom javascript code to be added to the file "registration" of the view "user" via the menu Display>Views.

On a side note, it is now possible to add validation controls on the custom fields of the address/user forms with the "regex check" field of the custom fields.

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

  • Posts: 267
  • Thank you received: 5
8 years 8 months ago #231982

I'm trying to incorporate to the file "registration " of the view " user " via the menu Display > Views a regex , using pattern , but does not work .

Not where I have to put.

Thanks Nicolas

Attachments:

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 8 months ago #231984

Hi,

This attribute is not supported for all the browsers:
www.w3schools.com/tags/att_input_pattern.asp
So make sure that your browser supports it.
Also, the "registration" file is only used when the "use bootstrap design" setting is turned off. If it's on, it's the file registration_bootstrap that you want to edit to add that attribute.

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

  • Posts: 267
  • Thank you received: 5
8 years 8 months ago #232150

Hi Nicolas,


Different tests performed it with the pattern attribute.
But me the following questions arise :
1. Indeed in some browsers do not work in any case.
2. Even in the test so I've done by adding a field called country code , works for example in chrome and change the pattern assigned username does not. I do not understand why.
Best regards and thanks for your patience .

Last edit: 7 years 2 months ago by dvddvd.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 8 months ago #232159

Hi,

You're missing a double quote for the pattern attribute value of the username field:
take.ms/JYqBK

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

  • Posts: 267
  • Thank you received: 5
8 years 8 months ago #232228

Gracias Nicolas

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

  • Posts: 267
  • Thank you received: 5
8 years 7 months ago #235968

Hi Nicholas, a new question:
how do I do to:
force data save this form in capital letters ?.
I mean the registration form
Thank you.

Last edit: 8 years 7 months ago by dvddvd.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 7 months ago #236006

Hi,

You can try to use such regex check:

^[A-Z]+$

Last edit: 8 years 7 months ago by nicolas.
The following user(s) said Thank You: dvddvd

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

  • Posts: 267
  • Thank you received: 5
8 years 7 months ago #236016

Thank you, but I want the name and adrees , also sent in case the server.

No where to place : strtoupper , if that is the correct method .

A cordial greeting,

David

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 7 months ago #236049

Hi,

Then it's not a validation you want but an action.
In that case, I would recommend to try with mass actions like this :
take.ms/18rGX
You can configure them via the menu System>Mass actions.

The following user(s) said Thank You: dvddvd

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

  • Posts: 267
  • Thank you received: 5
8 years 7 months ago #236116

Thanks is the solution I was looking for !!!!

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

  • Posts: 267
  • Thank you received: 5
8 years 7 months ago #236594

Hello Nicolas,
I tried to apply the solution you've given me .
But I do not get it to work .

Greetings,
David

Attachments:
Last edit: 8 years 7 months ago by dvddvd.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #236692

Hi,

I just tried on my local and the address is correctly edited via the mass action with the same setup than you.
Just to be sure, the used trigger is "after an address is created" right ? If not, so that's the issue. ;)

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

Time to create page: 0.095 seconds
Powered by Kunena Forum