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

10 years 6 months ago #235778 by krileon
Press F12 when testing to review browser error console and see if your JS is erroring for whatever reason. Sorry there's not much more I can do for you. We do not provide coding assistance. The code provided is just examples and I have not tested them.


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.

10 years 6 months ago #235821 by romolo
Thanks Kyle

I understand that you do not offer custom coding assistance, but this is the developer forum and I am using 'out of the box' functionality.

This should just work. And it does for standard text fields but I cannot get it to work for Radio buttons, so I really do still need yours, Beat's etc... assistance please

Kind regards

R

Please Log in to join the conversation.

10 years 6 months ago #235822 by romolo
Using this as a test:

$( '#username' ).val( '[post_cb_gender]' );

This inserts the value of the cb_gender field into a text field.

The results are "on".

So regardless of "a Man" or "a Female" being selected it says "on" as the name of the field is cb_gender.

How can I catch the value?

Thanks in advance

R

Please Log in to join the conversation.

10 years 6 months ago #235824 by romolo
I have got it working! Through all my testing back and forth and amendments the value option was altered and was misspelt in the original custom form.

FOR THE RECORD:

$( '#username' ).val( '[post_username]' );
if ( '[post_cb_gender]' == 'male' ) {
$( '#cbf322' ).attr( 'checked', 'checked' );
} else if ( '[post_cb_gender]' == 'female' ) {
$( '#cbf323' ).attr( 'checked', 'checked' );
}

This format now works using:

<form id="reg_mod" action="index.php?option=com_comprofiler&amp;task=registers" method="post"><input type="hidden" name="option" value="com_comprofiler" /><input type="hidden" name="task" value="registers" /><input type="hidden" name="ismodule" value="yes" />
<div><label for="reg_mod_name">User Name</label><input id="reg_mod_username" class="MyClass" type="text" name="username" size="14" />
</div>
<div><label for="reg_mod_cbf322">Gender&nbsp;</label>Male&nbsp;<input id="reg_mod_cbf322" class="MyCheck" type="radio" name="cb_gender" value="male" />&nbsp;Female&nbsp;<input id="reg_mod_cbf323" class="MyCheck" type="radio" name="cb_gender" value="female" />
</div>
<div><br /><input class="button" type="submit" value="Register" />
</div>
</form>

As the form.

Thanks for all your help Kyle.

Kind regards

R
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.227 seconds

Facebook Twitter LinkedIn