BF : radio button, string manipulation and no value

  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 176
  • Thank you received: 5

Gilles361 created the topic: BF : radio button, string manipulation and no value

Hi,

I've created a hidden element to create a column Department number 2 digits (Departement) from a Post ZIP code (CodePostal). I'm using radio buttons choice, text input for ZIP code and next/previous (custom button):

Element name: Departement

function ff_Departement_init() {
var code = jQuery('[name="ff_nm_CodePostal[]"]:checked').val() ;
// Get 2 digits
var dpt = code.substring(0, 3) ;
// Write 2 digits to 'Departement' element
ff_getElementByName('Departement').value = dpt ;
} // ff_Departement_init

I'm using similar code on a TEST Form, it's OK, both number or string

But on this bigger form (40 elements), I can't populate my var new data string "empty" to "Departement" element...

Any idea !
Thanks, Gil
#236691
  • Posts: 2428
  • Karma: 85
  • Thank you received: 330

mihaela replied the topic: BF : radio button, string manipulation and no value

Hello,

From what you have written, this should work in case the ZIP code's value in "CodePostal" is prefilled before opening the page on which the Department field is.
In that case, it might be that you haven't checked the "Page Entry" checkbox in the "Initscript" section.

If you wish that the "Departement" field gets filled in after making a change like selecting a number in the "CodePostal", then the code shouldn't be put in "Initscript", but in "Actionscript".

Therefore, please go to the Actionscript section of the "CodePostal" field in your form. Set Type to "Custom" and mark "Change" as Action.
In the code below you should put code like this:
function ff_CodePostal_action(element, action) {
var code = jQuery('[name="ff_nm_CodePostal[]"]:checked').val() ;
// Get 2 digits
var dpt = code.substring(0, 3) ;
// Write 2 digits to 'Departement' element
ff_getElementByName('Departement').value = dpt ;
} // ff_CodePostal_action

Let me know whether that resolves the issue.

Regards,

Mihaela
#236706
  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 176
  • Thank you received: 5

Gilles361 replied the topic: BF : radio button, string manipulation and no value

Hi,
My code was ok, as you explained.
I've implemented your way (copy your code, action change)
Same problem : Departement is still "empty", so not create in BF record ...

My simple BF TEST form works ok!
BR, Gil
#236715
  • Posts: 2428
  • Karma: 85
  • Thank you received: 330

mihaela replied the topic: BF : radio button, string manipulation and no value

In that case, could you please send me a package with your form so I can see why this is not working.

Please create a package as explained here crosstec.org/en/support/online-documenta...ted/94-packages.html , zip it and send it as an attachment.

Regards,

Mihaela
#236723
  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 176
  • Thank you received: 5

Gilles361 replied the topic: BF : radio button, string manipulation and no value

Hi Mihaela,
I've sent information to your email.
Gil
#236741
Moderators: ForumSupporttomeperica
Time to create page: 0.064 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here