[#1291] Required fields still required when hidden

14 years 6 months ago #111614 by softforge
softforge wrote:

I have set up some plans which have different required fields associated with them. I have applied the field protection plugin and set the relevant fields to hide at registration which all works fine.

The problem is that some of the fields are required at registration but only for certain plans. Although they successfully hide depending on the plan that is chosen, they are still requires and it wont let you register without filling them in (even though they are hidden).

The only way to register in this situation is go though each plan and fill in the required fields while they are visible. Obviously this is not a viable solution for the end user plus they then get irrelevant data associated with their profile.

What is needed is some additional logic so when a field is hidden (on choosing a plan), it is also removed from the submit validation (if required or validation exists) allowing a user to register.

It would also be great if the value of the field was cleared on hiding as then if a user filled it in and then changed their mind and chose a different plan, irrelevant data wouldn't get submitted.


I posted this issue for CBSubs 1.0.2 and it has now been fixed in the JavaScript validation, thank you!

But, there is still an issue with the server validation. I am using the CB Ajax File Field Plugin and it does not validate with JavaScript (it would be nice if it did). So if you choose a plan that causes it to hide, the form lets you submit but it is rejected as it is a required field.

Not sure if this is a problem with CBSubs or CB Ajax File Field Plugin. Either way, its a big problem for me as we have held back launching a site until CBSubs 1.0.3 was released so we could enforce some subscription plans to upload a file during registration.

Any idea if there is a quick workaround for this?

Many thanks.

Post edited by: krileon, at: 2009/11/05 17:14

If you like our plugins, please consider writing a review on the Joomla Extension Directory or the Community Builder Directory ...

Please Log in to join the conversation.

14 years 6 months ago #112357 by guidoterhorst
Replied by guidoterhorst on topic Re:Required fields are still required when hidden
I don't get it. I still need my normal text fields wich i set as required to be filled.

I want them to be neglected when not shown. Then, when the user logges in, he gets redirected (second time login because first time doesn't function yet) to his profiel edit page, and he cannot save without completing the missing fields. This is for me the ideal situation.

Please explain what is and what isn't functioning with the required fields.

Thanx

Please Log in to join the conversation.

14 years 6 months ago #112510 by krileon
I believe the only two fields that will have this problem is Image and File as their validation is handled after registration form submission.

Post edited by: krileon, at: 2009/09/28 18:14


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

14 years 6 months ago #112514 by softforge
Yes, I can confirm that the image field also has this problem.

The only other validation I can think of that is done after submission is the custom PERL regular expression, but I don't see that being a problem...

If you like our plugins, please consider writing a review on the Joomla Extension Directory or the Community Builder Directory ...

Please Log in to join the conversation.

14 years 6 months ago #112522 by softforge
UPDATE: I just check the PERL regular expression and it does still validate fields even if they are hidden! And so does the integer field!

This usually isn't a problem because the user normally selects their subscription plan first, thus hiding the fields. But if they don't selects their subscription plan first or change their plan, they could quite easily enter invalid data into an integer field or one with a custom PERL expression (which I just did). Then selecting or changing a plan hides these field and the data they entered. This has the effect of rejecting the form submission and taking them back to the registration page, still with the invalid fields hidden and leaving the user in a loop of frustration! In the event that all of the hidden data they entered was valid, it actually does get stored in their profile but is never again accessible to them, which is not ideal.

I see a simple fix to this one. When hiding a field, also clear its value. This gets round the server validation of the integer and PERL regular expression. It also helps ensure that no erroneous data gets added to the user's profile which they can never see or edit.

There is still a problem with required file and image fields though, I have found no way to bypass those...

Post edited by: softforge, at: 2009/09/28 19:14

If you like our plugins, please consider writing a review on the Joomla Extension Directory or the Community Builder Directory ...

Please Log in to join the conversation.

14 years 6 months ago #112529 by softforge
Although thinking about it, simply not validating or storing hidden fields would defiantly be the best option. You wouldn't want a user to fill out a big registration form, then click on each plan in turn (eg. to see its children) to discover that half the data they entered had been removed!

I can imagine users doing that on my site! :blink:

One option to avoid this happening would be to clear the values of the hidden fields on clicking the submit button...

If you like our plugins, please consider writing a review on the Joomla Extension Directory or the Community Builder Directory ...

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.266 seconds

Facebook Twitter LinkedIn