Connecting two drop-down lists

josipk shared this question 1 month ago
Answered

Hello,

I have a small problem. Maybe someone can help me. :)

So, I have created list1 and list2. List2 is filled with names of functions in list1. I want to plot a function I choose from list2, but I can't do it. :( I tried it like this: t = SelectedIndex(tekst2), and then f(x)=SetValue(lista1, t). But it won't work. :(

Can someone help me with that?

Btw, I am dumb for JavaScript, so please don't send me there. :D

Comments (4)

photo
1

Maybe I'm dumber than you :smile: and I haven't understood the question, but can't you just create the SelectedElement as a function and show that?

See the attached file.

List1=List of function

List2=Shuffled List1

p(x)= selected element of list 2

Of course if you attach your file here, we can check dependancies and else

photo
2

or this (if i understand well..)

photo
2

and a deluxe variant

photo
1

Ok, I am dumb. :) But your answers were really helpful! :) Thank you for that.

This was that I needed. There are two lists. The user chooses a function from list1 (only names), and from the second list takes the corresponding element and plots it.

So, for example:


list1={"f1", "f2", "f3"} ------------------- make it a drop-down list

list2={x, x+1, -x^2}

f(x) = Element(list2, SelectedIndex(list1))

So simple, but I was just too sleppy to see it at the moment. :D

Thx again once again! :)

© 2021 International GeoGebra Institute