TOPIC:

Change textfield according to selected checkboxes 1 month 1 week ago #246691

  • Topic Author
  • monomgabriel
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 51
  • Thanks: 0
Hi,

I have a checkboxgroup, named switcher, which contains some choices.

Example:
1;Project 1; Project 1
2;Project 2; Project 2
3;Project 3; Project 3

and a blank textfield, named textfield.

The following code always return "Project 1".
function ff_FormName_init(element, message)
{
  ff_getElementByName("textfield").value = ff_getElementByName("switcher").value;
}

How to take into account other choices?

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

Change textfield according to selected checkboxes 1 month 1 week ago #246696

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1261
  • Karma: 3
  • Thanks: 110
Hi,

go to your checkboxgroup element->Advanced->Actionscript->check custom->check click and put this:
function ff_NAMEOFCHECKBOX_action(element, action)
{
    switch (action) {
        case 'click':
ff_getElementByName('NAMEOFTEXTFIELD').value=jQuery('[name="ff_nm_NAMEOFCHECKBOX[]"]:checked').val();
            break;
        default:;
    } // switch
} // ff_check_action

Please replace:
- NAMEOFCHECKBOX with name of your checkboxgroup (not title)
- NAMEOFTEXTFIELD with name of your textfield (not title)

Let me know if it works for you

Regards,
Tihana

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

Change textfield according to selected checkboxes 1 month 1 week ago #246711

  • Topic Author
  • monomgabriel
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 51
  • Thanks: 0
Thanks!
So if I do not select "click" in the Script Action section, it will not work.
Is there any documentation about theese checkboxes (click, modify, focus, etc.)?
Would I have had the same result if I had done this code in the script section in the "More options" section of the form head?
And last point, can I add database connection in this script?

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

Last edit: Post by monomgabriel.

Change textfield according to selected checkboxes 1 month 1 week ago #246713

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1261
  • Karma: 3
  • Thanks: 110
Hi,

for this you need to use action script (on click populate textfield with value from checkbox).

It depends on why you need database connection -> this you can use in form->Advanced->more options

Regards,
Tihana

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

Last edit: Post by tihana.krivic.

Change textfield according to selected checkboxes 1 month 1 week ago #246738

  • Topic Author
  • monomgabriel
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 51
  • Thanks: 0
Because it is a dynamic request, depending on the checkbox checked, I think I need to use some JQuery.ajax(). Does it exist an equivalent in BreezingForms "language"?

How can I find the path from my JavaScript script to my php piece, when calling it in a AJAX method?

Can I use a call to the php function ff_select(), in my $.get() method?

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

Last edit: Post by monomgabriel.

Change textfield according to selected checkboxes 1 month 1 week ago #246768

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1261
  • Karma: 3
  • Thanks: 110
Hi,

sorry for misunderstanding, but I think that you want to populate textfield based on checkeboxes select :)

If you want AJAX request, then that request should be placed in actionscript of element.

When you call an AJAX than inside url you need to add path to your file:
url: "<?php return JURI::root(true ); ?>/path/to/your/phptemplate",

Have you created any php file in the meantime, then you need to add path to this php file?

Regards,
Tihana

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

Moderators: ForumSupport
Time to create page: 0.051 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!