TOPIC:

Check/Unchek all button in radiogroup 9 years 1 month ago #79981

  • Topic Author
  • aschweyer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 56
  • Thanks: 0
:(Help i need somebody, help.....!!!
Hello dear support team,

I use BreezingForms 1.7.5 Stable (build 761) and Quickmode.
Could anybody explain to me how ff_setChecked () works. After a few days looking at the forum I didn't find out....
I have unfortunately no developer knowledge but this is the js code i found:

function ff_setChecked(name, value, checked)
{
if (arguments.length<3) checked = true;
for (var i = 0; i < ff_elements.length; i++)
if (ff_elements[2]==name) {
var e = ff_getElementByIndex(i);
if (e.value == value) {
e.checked = checked;
break;
} // if
} // if
} // ff_setChecked

I have a radiogroup called Ret in a user rewritable form:
0;Yes;yes
0;No;no
When users come back later to complete the form i need that both radio button "Yes" an "No" are unchecked again at form or page load.

I can only check/uncheck the first button i.e. "Yes".
ff_setChecked('Ret','yes', true); ----> check the Yes button
ff_setChecked('Ret','yes', false); ----> uncheck the Yes button
I guess looking at the code and after test that true and false or 1 and 0 are the values to chek uncheck.

Why it doen't work or what i am doing wrong for the "No" button?
ff_setChecked('Ret','no', true); doesn't work
ff_setChecked('Ret','no', false); doesn't work
ff_setChecked('Ret','no', 1); doesn't work
ff_setChecked('Ret','no', 0); doesn't work

Thanks for you help.
Alain

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

Re: Check/Unchek all button in radiogroup 9 years 1 month ago #81123

  • Topic Author
  • aschweyer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 56
  • Thanks: 0
Hello anybody there,

Should it be possible to have a reply? I really need to use this ff_setChecked function.

Thanks
Alain

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

Re: Check/Unchek all button in radiogroup 9 years 4 weeks ago #81518

  • Topic Author
  • aschweyer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 56
  • Thanks: 0
Help would be really appreciated for this.....
Since now i have no solution for that and I already was spending a lot of time in the forum.

Thank you,
Alain

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

Re: Check/Unchek all button in radiogroup 8 years 6 months ago #91591

  • srseale
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 45
  • Thanks: 3
Not certain if your ever got an answer to this issue. I noticed the same problem and found a very simple solution.

The problem is in the BF code and the way in which a field is identified. With radio groups, it can only identify the first button. To get around this, I used jQuery to find the button based on its Name and Value attributes (properties). Here is the code I used:

start code snippet
function ss_setChecked(jname, jvalue)
{
fieldName = "ff_nm_" + jname + "[]"; // adds BF prefix and suffix (may change in future)
// Use jQuery to set the button on (checked = true)
jQuery('[name="' + fieldName + '"][value="' + jvalue + '"]').attr("checked", true);
}
end code snippet

As you can see, it is set up as a function that you can store in the Manage Scripts area. I chose to call it ss_setChecked to differentiate it from the original function. Here are the instructions for its use:

start instructions/description
This function uses jQuery to set a radio button based on the button's Name and Value attributes.

Example: ss_setChecked('bName', 'bValue');

Where: bName is the name of the form field
bValue is the value of the button you want to set

With a radio button field named chooseNumber defined as follows:

1;Default;default
0;First;first
0;Second;second
0;Third;third

ss_setChecked('chooseNumber', 'second');

sets the "Second" button on.
end instructions/description

I am using version 1.8 of BF and jQuery 1.6.4, so things may be a little different in your case. You are welcome to use this code if you wish. There is no guaranty of functionality or suitability to a specific purpose implied or otherwise. Your mileage may vary!

srseale
The following user(s) said Thank You: imago

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

  • Page:
  • 1
Time to create page: 0.046 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!