TOPIC:

Reset form values on turn off 3 years 6 months ago #203138

  • marino.brnardic
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 405
  • Karma: 9
  • Thanks: 35
Here's the script:
function ff_radio_action(element, action) //where radioelem is the name of the radio group
{
     switch (action)
     {
          case 'change':
          vals = '';
          opts = JQuery("[name=\"ff_nm_radio[]\"]");
          for (o = 0; o < opts.length; o++)
          if (opts[o].checked){
               vals = opts[o].value;
          }
          if (vals=="yes") // here you can add further dependencies
          {
            jQuery('[name="ff_nm_selectlist[]"]').prop('selectedIndex',0);
            return bfToggleFields('on','section','sec',bfDeactivateField);
          }
          else
          {
            return bfToggleFields('off','section','sec',bfDeactivateField);
          }
          break;
          default:;
     } // switch
} // ff_radioelem_action

The form is in the attachment. Let me know if you need help.

Regards,
Marino

File Attachment:

File Name: test_form_...14-2.zip
File Size:8 KB
Need to renew Pro Support?
Buy Here!
=========================================
Satisfied?
Consider a membership!
=========================================
Like us on Facebook
=========================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
Attachments:

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

Reset form values on turn off 3 years 6 months ago #203141

  • Topic Author
  • maxwbr
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 22
  • Thanks: 0
I am extremely grateful for the help, seriously, very much. But, unfortunately I do not think I was clear on my difficulty. I apologize.

I need to clear other fields based on a list. See attached image.

I select the value (red arrow). I need to clear the fields when I select another value (green arrow).

Attachments:

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

Reset form values on turn off 3 years 6 months ago #203145

  • marino.brnardic
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 405
  • Karma: 9
  • Thanks: 35
Got it. Here's the script:
function ff_selectlist_action(element, action)
{
    switch (action) {
        case 'change':
        if(ff_getElementByName('selectlist').value == 'value3'){
           ff_getElementByName('textfield1').value = '';
           ff_getElementByName('textfield2').value = '';
           ff_getElementByName('textfield3').value = '';
           ff_getElementByName('textfield4').value = '';
        }
            break;
        default:;
    } // switch
} // ff_selectlist_action

The form is in the attachment. Let me know if this is the solution you need.

Regards,
Marino
Need to renew Pro Support?
Buy Here!
=========================================
Satisfied?
Consider a membership!
=========================================
Like us on Facebook
=========================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
Attachments:

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

Reset form values on turn off 2 years 2 months ago #231893

  • LaurieM
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 16
  • Thanks: 0
Hi there!

Looks like this will do my job.

Would you please show me how to clear all form fields when value1, value2, value4, value5 and value6 are selected in the Select List.

That is: When a site visitor changes their mind about their choice from the select list, how do I clear fields already filled so that I don't get false info in the database?

Thanks,
Laurie.

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

Reset form values on turn off 2 years 2 months ago #231900

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

Here is how to achieve what you want.
Go Advanced properties of that select list element and in the Actionscript section set Type to Custom and Action to Change.

Then in code area below paste the following code:
function ff_selectlistname_action(element, action)
{
var tmp = ff_getElementByName('selectlistname').value;
eval('document.' ff_processor.form_id).reset();
ff_getElementByName('selectlistname').value = tmp;
} // ff_selectlistname_action
NOTE: In the code above replace every instance of selectlistname with the Name of that select list element.

Let me know whether this works as you wanted.

Regards,

Mihaela

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

Reset form values on turn off 2 years 2 months ago #231911

  • LaurieM
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 16
  • Thanks: 0
Hi Mihaela,

I'm not sure whether we're talking about the same thing, but the code you gave doesn't work for me.

Thanks for the quick response!

The code given in an earlier post works for value3. If I could duplicate this for the other values I'd be OK to go:

function ff_selectlist_action(element, action)
{
switch (action) {
case 'change':
if(ff_getElementByName('selectlist').value == 'value3'){
ff_getElementByName('textfield1').value = '';
ff_getElementByName('textfield2').value = '';
ff_getElementByName('textfield3').value = '';
ff_getElementByName('textfield4').value = '';
}
break;
default:;
} // switch
} // ff_selectlist_action

Is it possible to duplicate line 5, only with another value? Everything I've tried breaks the function of the code.

Note: I'm currently working with a basic test form where I have a select list with two options. Each option has conditionally two text fields.

When someone chooses option 1, fills in a field and then changes to option 2 to complete the form, the info in the field from option 1 remains and gives false info to the Database.

I need to clear all fields upon changing the choice in the select list.

Thanks,
Laurie.

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

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