Add javascript to a form?

Hello, how to add javascript in my form? I use the .xlsx method

Hi @yvoncio,

Welcome to the community! Would you mind showing a demo so that we could help you out if it’s possible in KoBoToolbox.

Have a great day!

OK thanks sir @Kal_Lam . I don’t have a demo as such. I have a multiple list that I browse. but for each item I read information in a file with the “select_one_external” function. Now there are formulas that I have to apply according to the options checked. attached is the form and one of the external files. What I really want is to make the form really dynamic.

i want to send files . but kobotoolbox tell me that new users can’t upload attachments.

Hi @yvoncio,

You should now be able to upload an attachment.

Have a great day!

Hi @Kal_Lam. Ok thanks.

final_1.xlsx (67.8 KB) option_type.csv (3.1 KB) produit_type.csv (927 Bytes)

File in which the function select_one_external search for lists

itemsets.csv (2.4 KB)

Hi @Kal_Lam. any help?

Hi @yvoncio,

I tested them at my end and it seems to be working fine (with Enketo). So where would you like to have our support?

Have a great day!

Hi @Kal_Lam. thank you so much. yes everything works. now i would like to see how to add javascript to what already existed. Or a way to make it more dynamic and flexible.

I’m going to send you a little preview of what I want to do. I am worth implementing this form and at the end in the table display the amounts (which are calculated according to what was chosen previously and using the formulas)

Hi @Kal_Lam I followed your link but nothing

Hi @yvoncio,

Still exploring. Will get back to you if i find any good news for you.

Have a great day!

Hi @Kal_Lam.

Okay. thank you so much

Hi @yvoncio,
Unfortunately what you were looking for cannot be done on the system, From a security perspective, it would be impossible to allow users to run custom javascript. The benefits may be immense to a user but the security loophole may be way more than that.

Stephane

1 Like

Hi @stephanealoo. Thanks .I take this opportunity to ask you if there is another issue
to my problem?

Hi @yvoncio,

I don’t there should be an issue over your xlsform as i was able to successfully upload and deploy the same in my account.

Kindly please do reach out if you have any issue!

Have a great day!

Hi @Kal_Lam.

Yes the xlsform works. I’m looking for a way to make it more dynamic.
for example. And I have integer fields like:

  • age
  • duration
  • period
  • capital C1
  • capital C2
  • prime P1
  • prime P2

And I have formulas like:

F = ($ {age} * $ {duration}) + ($ {C1} - $ {C2})
or
F = (2970 * $ {period} * $ {age} * $ {duration}) + ($ {P1} - $ {C1} - $ {C2})

how to do it with the calculate function? Knowing that I read the formula in an external file

1 Like

Hi @yvoncio,

These calculate should work smoothly.

Have a great day!

1 Like