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

10 years 6 months ago #235757 by romolo
OK.. Gone through the lot.

My initial form is this:

<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="pbdinputtext" type="text" name="username" size="14" /></div>
<div><label for="reg_mod_cbf322">Gender&nbsp;</label>Male&nbsp;<input id="reg_mod_cbf322" class="pbdintrocheck" type="radio" name="cb_gender" value="a Man" />&nbsp;Female&nbsp;<input id="reg_mod_cbf323" class="pbdintrocheck" type="radio" name="cb_gender" value="a Woman" /></div>
<div><br /><input class="button" type="submit" value="Register" /></div>
</form>

My CB Reg form looks like this:

<table class="cbMulti">
<tr><td><input type="radio" name="cb_gender" class="required" class="required" value="a Man" id="cbf322" /> <label for="cbf322">a Man</label></td><td><input type="radio" name="cb_gender" class="required" class="required" value="a Woman" id="cbf323" /> <label for="cbf323">a Woman</label></td></tr>
</table>

And my auto actions are this:

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

Still not working ?!?!?

R

Please Log in to join the conversation.

10 years 6 months ago #235758 by romolo
I have the same auto action working for the username... so I know it is capable... and it does work if I specify checked and NOT do the IF.

Whats wrong.

Many thanks in advance

R

Please Log in to join the conversation.

10 years 6 months ago #235762 by romolo
Also tried without assigning values to the radio as my USERNAME works without these.

R

Please Log in to join the conversation.

10 years 6 months ago #235769 by krileon
The code I provided was an example. You needed to adjust it for your usage. You need the post values so you'd need to use the below.

if ( '[post_cb_gender]' == 'a Man' ) {
    $( '#cbf322' ).attr( 'checked', 'checked' );
} else if ( '[post_cb_gender]' == 'a Woman' ) {
    $( '#cbf323' ).attr( 'checked', '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 to join the conversation.

10 years 6 months ago #235772 by romolo
Nope... Still only the username works.

As soon as I try using the IF it stops working. I even tried the username as a test using a string and I cannot get it to evaluate as positive.

R

Please Log in to join the conversation.

10 years 6 months ago #235773 by romolo
Just got username working as an IF... so its not that.

R

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.240 seconds

Facebook Twitter LinkedIn