This topic is locked

Remove option based on previous field

2/14/2018 4:51:06 AM
PHPRunner General questions
J
Juliosor author

Hello,
first of all excuse me if this was answered or documented before, as I didn't find anything of the sorts.
I have two fields, which are different fields in the database as well, both of them are configured with the lookup wizard to load a pre-defined number of options:


[size="1"]Image Link just in case[/size]
I dumbed down the example for it to be numbers, let's say you can only choose numbers from 1 to 10.
The first field uploads a number to the database. The second, a list of numbers separated by commas (as I guess is the default behaviour for multiple-selection with the lookup wizard).
What I want:

  • Good: If a number is chosen in the firstfield, then the user can't choose that same value in the secondone. This has to be done dinamically as the user will fill the form in one go.
  • Fantastic: The same but with the reverseorder, advancing from the second field to the first. I suspect it's a bit harder as we are dealing with a list.


What is the best way to do this taking advantage of PHPRunner's structure?
Cheers

admin 2/14/2018

This can be done but going to be complicated. Removing an option is not enough as you need to add removed options back if user changes selection. It means you need to keep a list of options of both controls somewhere in memory. Not impossible, just complicated.