Forums

Radio Box - Default Value

merlinwizart 18 Sep, 2011
Hi,

I have Chronoforms 4.0 RC2.0 installed on Joomla 1.7.0.

I am trying to built a regular form with the wizard.
When I use the 'standard' Radio Box I just want the first radiobutton ( No=No ) checked by default.
When Field Default Value is empty --> none is checked
When Field Default Value is No --> also none checked

Please help
GreyHead 18 Sep, 2011
Hi merlinwizart,

This looks like a bug to me.

The fix is to edit the file administrator/components/com_chronoforms/helpers/html_helper.php and look for the block starting case 'radio': around line 234. Replace the entire block (down to the line break;) with this:
			case 'radio':
				if(isset($fieldoptions['value']) && !empty($fieldoptions['value'])){
					$tag['checked'] = $fieldoptions['value'];
				}
				unset($fieldoptions['value']);
				$options = array();
				if(isset($tag['options']) && is_array($tag['options'])){
					$options = $tag['options'];
					unset($tag['options']);
				}
				if(isset($tag['ghost'])){
					if((bool)$tag['ghost'] === true){
						$output .= '<input type="hidden" name="'.$fieldname.'" value="'.$tag['ghost_value'].'" alt="ghost" />'."\n";
					}
					unset($tag['ghost']);
					unset($tag['ghost_value']);
				}
				foreach($options as $k => $option){
					if ( $k == $tag['checked'] ) {
						$checked = "checked='checked'";
					} else { 
						$checked = "";
					}
					$output .= "<input type='{$fieldoptions['type']}' name='{$fieldname}' id='{$this->slug($fieldname.'-'.$k)}' title='{$tag['title']}' value='{$k}' class='{$tag['class']}' {$checked} >"."\n";
					$output .= '<label for="'.$this->slug($fieldname.'-'.$k).'">'.$option.'</label>'."\n";
				}
				break;

Bob
TwoArmedBandit 18 Sep, 2011
I have the same issue. The code change doesn't seem to have helped.

What should be be putting in the "Field Default Value" box? The default input from the list of options, or a number to correspond with the position of the default choice?

Thanks

Colin
TwoArmedBandit 18 Sep, 2011
I'm wrong.

I had the wizard open when I pasted in the new code, which I think prevented the script being updated. Seems to be working ok now I've saved it with the Wizard closed...

Thanks
moreiter 21 Sep, 2011
Hi GreyHead,

this solution was working with Joomla 1.7 and CF RC1.8 and RC1.9.
Today I have updated to the RC2.0 version and now my radio button is unchecked again.

If I use the ghost function it works in IE9 with the standard script but not in FF.
The modified code from above is not working in both browers.

What am I doing wrong?
Kind regards,
Monika
GreyHead 21 Sep, 2011
Hi Monika,

I'm not clear which part isn't working for you?

The fix was built in CFv4 RC2.0 and is working for me in FireFox (it shouldn't depend on the browser).

Bob
moreiter 21 Sep, 2011
Hi again,

your fix was working until I updated to CF RC2.0 ... after that none of the version (install package or your code from above) did the job.
My solution is now quite simple: I added checked="checked" to the html source :wink:

Kind regards,
Monika
Max_admin 22 Sep, 2011
Hi all,

issued fixed, you may contact me through the contact us page to get a patch for that file or apply Bob's fix here.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
uday.dahale 17 Oct, 2012
Hello max,

My form Radio box is not working..
The data is not save into the database

my form radio box code is...

<div class="ccms_form_element cfdiv_radio" id="areyouinterested1_container_div" style="">
<label>Are you interested to know more about Healthcare Sourcing portal?</label>
<input type="hidden" name="areyouinterested" value="" alt="ghost" />
<div style="float:left; clear:none;">
<input type="radio" name="areyouinterested" id="areyouinterested_0" title="" value="yes" class="validate['required']" />
<label for="areyouinterested_0">Yes</label>
<input type="radio" name="areyouinterested" id="areyouinterested_1" title="" value="no" class="validate['required']" />
<label for="areyouinterested_1">No</label>
</div>
<div class="clear"></div>
<div id="error-message-areyouinterested"></div>
</div>


regards,

uday
GreyHead 17 Oct, 2012
Hi uday.dahale ,

This is an old thread :-( Do you have a column named input_radio_are_you_interested in your database table? If so please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.

Bob
uday.dahale 17 Oct, 2012
hello thank you very much for reply bob sir,
the debugger shows me result as shown below...

Data Array:

Array
(
    [option] => com_chronoforms
    [chronoform] => registera
    [event] => submit
    [Itemid] => 
    [input_first_name] => xyzq
    [input_last_name] => dfasd
    [input_designation] => sdfas
    [input_organisation_name] => sdfas
    [input_website] => sadfsad
    [input_email_id] => sadfas@asdf.com
    [input_address] => sdfasd
    [input_pincode] => 3434
    [input_city] => dasdf
    [input_state] => sdfas
    [input_contact_no] => 343434
    [input_mobile_no] => 34343
    [input_manufacturer] => dealer/distributor
    [choseyourbusinesstype] => Array
        (
            [0] => healthcareprofessional
            [1] => doctor
        )

    [areyouinterested] => yes
    [input_submit_16] => Submit
    [3c864fbc691798b194ad9ad6f5f9d81b] => 1
    [chronoform_data] => Array
        (
            [cf_uid] => 7c3f9cefcf6ef67182f8ee7060414db5
            [cf_created] => 2012-10-17 18:11:20
            [cf_created_by] => 0
            [cf_ipaddress] => 110.234.102.90
            [cf_user_id] => 0
            [option] => com_chronoforms
            [chronoform] => registera
            [event] => submit
            [Itemid] => 
            [input_first_name] => xyzq
            [input_last_name] => dfasd
            [input_designation] => sdfas
            [input_organisation_name] => sdfas
            [input_website] => sadfsad
            [input_email_id] => sadfas@asdf.com
            [input_address] => sdfasd
            [input_pincode] => 3434
            [input_city] => dasdf
            [input_state] => sdfas
            [input_contact_no] => 343434
            [input_mobile_no] => 34343
            [input_manufacturer] => dealer/distributor
            [choseyourbusinesstype] => Array
                (
                    [0] => healthcareprofessional
                    [1] => doctor
                )

            [areyouinterested] => yes
            [input_submit_16] => Submit
            [3c864fbc691798b194ad9ad6f5f9d81b] => 1
            [cf_id] => 12
        )

    [chronoform_data_cf_id] => 12
)

Validation Errors:

Array
(
)


regards,

uday
GreyHead 17 Oct, 2012
Hi Uday,

It looks as though areyouinterested has been saved to the database OK as 'yes'?

Bob
uday.dahale 17 Oct, 2012
Bob,

its totally blank...value...into the database table
check box value also blank

please fix the issue bob sir 😢 😢 😢 😢 😢 😢

regards,

uday
GreyHead 17 Oct, 2012
Hi Uday,

By all means email or PM me the site URL and a SuperAdmin login and I'll take a quick look.

Bob
uday.dahale 18 Oct, 2012
hello bob,

sorry bob I dont have access for that.


The radio box is working properly but the check box with group not working...


The check box code is

<div class="ccms_form_element cfdiv_checkboxgroup" id="business_type_container_div" style="">
<label for="business_type">Business Type</label>
<input type="hidden" name="business_type" value="" alt="ghost" />
<div style="float:left; clear:none;">
<input type="checkbox" name="business_type[]" id="business_type_0" title="" value="choice 1" checked="checked" class="validate['group[13]']" />
<label for="business_type_0">Buyer / Importer</label>
<input type="checkbox" name="business_type[]" id="business_type_1" title="" value="choice 2" class="validate['group[13]']" />
<label for="business_type_1">Doctor</label>
<input type="checkbox" name="business_type[]" id="business_type_2" title="" value="choice 3" class="validate['group[13]']" />
<label for="business_type_2">Dealer / Distributor</label>
<input type="checkbox" name="business_type[]" id="business_type_3" title="" value="choice 4" class="validate['group[13]']" />
<label for="business_type_3">Exporter</label>
<input type="checkbox" name="business_type[]" id="business_type_4" title="" value="choice 5" class="validate['group[13]']" />
<label for="business_type_4">Healthcare Professional</label>
<input type="checkbox" name="business_type[]" id="business_type_5" title="" value="choice 6" class="validate['group[13]']" />
<label for="business_type_5">Manufacturer</label>
</div>
<div class="clear"></div>
<div id="error-message-business_type"></div>
</div>


the debugger values is like this

Data Array:

Array
(
[option] => com_chronoforms
[chronoform] => healthcareregist
[event] => submit
[Itemid] =>
[first_name] => cc
[last_name] => cc
[organisation_name] => cc
[designation] => cc
[website] => cc
[email_id] => [email]cc@cc.com[/email]
[address] => cc
[pincode] => 23232
[state] => cc
[city] => c
[contact_no] => 22
[mobile_no] => 33
[business_type] => Array
(
[0] => choice 1
[1] => choice 4
[2] => choice 5
[3] => choice 6
)

[are_you_interested] => No
[input_submit_15] => Submit
[1383ce665d5472debc22771fba91cece] => 1
[chronoform_data] => Array
(
[cf_uid] => 0f85167e0276e0a10cbcbc6b1589cf0a
[cf_created] => 2012-10-18 11:39:07
[cf_created_by] => 0
[cf_ipaddress] => 110.234.102.90
[cf_user_id] => 0
[option] => com_chronoforms
[chronoform] => healthcareregist
[event] => submit
[Itemid] =>
[first_name] => cc
[last_name] => cc
[organisation_name] => cc
[designation] => cc
[website] => cc
[email_id] => [email]cc@cc.com[/email]
[address] => cc
[pincode] => 23232
[state] => cc
[city] => c
[contact_no] => 22
[mobile_no] => 33
[business_type] => Array
(
[0] => choice 1
[1] => choice 4
[2] => choice 5
[3] => choice 6
)

[are_you_interested] => No
[input_submit_15] => Submit
[1383ce665d5472debc22771fba91cece] => 1
[cf_id] => 7
)

[chronoform_data_cf_id] => 7
)

Validation Errors:

Array
(
)

I also attach the Screenshot of check box backend....
Please find the attachment
Please fix my issue bob sir...😢 😢 😢 😢


regards,

uday
uday.dahale 18 Oct, 2012
Hi bob,

Please reply..........😟 😟 😟 😟 😟


regards,
uday
GreyHead 18 Oct, 2012
Hi Uday,

We have this thing here called night time when we go to sleep for a short while . . . I'll be back later.

Bob
uday.dahale 18 Oct, 2012
hi bob,

thx for reply..

i am w8ing.....

regards,

uday
uday.dahale 18 Oct, 2012
hello bob,

single check box working properly but group check box not working...


Please fix my issue...😢 😢 😢

regards,

uday
GreyHead 18 Oct, 2012
Hi Uday,

Have you added a Handle Arrays action before the DB Save action?

Please see this FAQ

ob
uday.dahale 19 Oct, 2012
hello bob,

thax for reply...

its working in my side..




thanks and regards,
uday
This topic is locked and no more replies can be posted.