Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] Prefilling CB Register form with URL info or previous form

  • romolo
  • romolo
  • OFFLINE
  • Posts: 72
  • Thanks: 5
  • Karma: 1
11 years 2 months ago #235741 by romolo
Hey,

Please respond please

R

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
11 years 2 months ago #235742 by krileon

What am I doing wrong or missing as its a radio button scenario.

Radio buttons do not have values in the same sense that input fields do. You need to mark your radio button checked instead. CB assigns a unique ID to each radio fields radio button. You'll need to right click and inspect them in Chrome or Firefox with Firebug to find their unique ID. Once found you can mark them checked as follows.

Code:
$( '#cbf282' ).attr( 'checked', 'checked' );

Hey,

Please respond please

Please see my signature for business days and hours.


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.

  • romolo
  • romolo
  • OFFLINE
  • Posts: 72
  • Thanks: 5
  • Karma: 1
11 years 2 months ago #235743 by romolo
But If I have a field that asks for Male or Female as they are 2x radio buttons.

How do I detect WHICH ONE is checked to be able to pass across.

Otherwise BOTH will be checked.

R

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
11 years 2 months ago #235746 by krileon
You can condition for it in your Javascript using an IF statement. Example as follows.

Code:
if ( '[cb_gender]' == 'Male' ) { $( '#cbf322' ).attr( 'checked', 'checked' ); } else if ( '[cb_gender]' == 'Female' ) { $( '#cbf323' ).attr( 'checked', 'checked' ); }

With the above you still need to find the unique ID of each radio button so you can mark the right one checked.


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.

  • romolo
  • romolo
  • OFFLINE
  • Posts: 72
  • Thanks: 5
  • Karma: 1
11 years 2 months ago #235754 by romolo
Thanks Kyle...

I get all the logic and was working on this but I cannot get it to work. My IDs when I inspect are cbf322 and cbf323... So I do not need to add anything further.

My values are as follows:

if ( '[cb_gender]' == 'a Man' ) {
$( '#cbf322' ).attr( 'checked', 'checked' );
} else if ( '[cb_gender]' == 'a Woman' ) {
$( '#cbf323' ).attr( 'checked', 'checked' );
}

And tried without # sign

if ( '[cb_gender]' == 'a Man' ) {
$( 'cbf322' ).attr( 'checked', 'checked' );
} else if ( '[cb_gender]' == 'a Woman' ) {
$( 'cbf323' ).attr( 'checked', 'checked' );
}

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

  • romolo
  • romolo
  • OFFLINE
  • Posts: 72
  • Thanks: 5
  • Karma: 1
11 years 2 months ago #235755 by romolo
It seems

$( '#cbf322' ).attr( 'checked', 'checked' );
$( '#cbf323' ).attr( 'checked', 'checked' );

is correct when I test.. but I cannot get the IF working for my values. Should it read something else like if checked in some way.

R

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

Moderators: beatnantkrileon
Powered by Kunena Forum