Skip to Content Skip to Menu

[SOLVED] Radio button, if value = "no" don't allow register

12 years 2 months ago - 12 years 2 months ago #195789 by deltafidesign
Is there a way to have a radio button that show me 2 values "yes" and "no", and if "no" then I can't proceed with registration?
Last edit: 12 years 2 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 47949
  • Thanks: 8170
  • Karma: 1434
12 years 2 months ago - 12 years 2 months ago #195823 by krileon
Hmm, as CB uses a function to continue processing even on event of user termination I don't think a redirect action will work in CB Auto Actions. What you'll need to probably do is use CB Auto Actions with a code action with Before Registration trigger and set an error into $_PLUGIN or into $user (e.g. $user->_error = 'FAIL!'). You'll probably want to also condition that radio field based off its post value (e.g. [post_FIELDNAME]).


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.
Last edit: 12 years 2 months ago by krileon.

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

12 years 2 months ago #195857 by deltafidesign
Replied by deltafidesign on topic Re: Radio button, if value = "no" don't allow register
Could you please help me to set the auto action?

That's what I've done but didn't work:

Type: code

Trigger: onBeforeUserRegistration

User: automatica

Access: all not registered users

Conditional: [cb_checkprivacy] = non acconsento

Method: PHP Eval

Code: $user->_error = 'FAIL!'

Return: echo

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 47949
  • Thanks: 8170
  • Karma: 1434
12 years 2 months ago #195861 by krileon
Your code isn't going to work like that. It was simply an example. An example to set an error with $_PLUGIN is as follows. Ensure you're testing with debug mode and maximum error reporting enable in Joomla global configuration or you'll never seen any errors in your code if there was one.
Code:
global $_PLUGINS; $_PLUGINS->_setErrorMSG( 'This is an error message.' );

Sorry, my role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement.


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 or Create an account to join the conversation.

12 years 2 months ago #195998 by deltafidesign
Replied by deltafidesign on topic Re: Radio button, if value = "no" don't allow register
I've done a little trick without CB Auto Actions and without any hack at the code.

Tell me please if I could have problems in future (next releases, something I could not have considered yet, etc...)

That's what I've done using CB Conditional and CB Subs:

- created 1 radio buttons with 2 values: yes - no
- created field delimeter
- CB Conditional for this delimeter field: show if "no"
- created a text field
- CBSubs hide this field at registration
- CB Conditional set this text field as requested if "no"

I've tested it and if I set the radio field "no" it correctly show me the field delimiter message and don't show the text field that now is set as required; but user cannot type anything into that text field 'cause CBSubs hide it at registration so if I click on the register button I can't proceed till I don't set "yes".

Could I encounter problems in future with this trick?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 47949
  • Thanks: 8170
  • Karma: 1434
12 years 2 months ago - 12 years 2 months ago #196010 by krileon
That seams like it should work fine. No idea if it'd cause future problems, but can't see any reason why it should.


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.
Last edit: 12 years 2 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum