.addOption for catalog variable (lookup select box) in case ref qual not satisfied - BUT only on first change!!!

Zod
Giga Guru

Hey,

SO strange. I need help here!

I have a scoped variable set up as a lookup select box and link to a custom table that contains similar entries like sys_choice ... to be used for the lookup.

I'm using a ref qual condition that works fine when choosing valid entries from the table within a catalog item ... All fine!

No I need for certain cases (depending on a change mad in an other variable) to ADD an OPTION that is NOT part of the table I'm using for my choices.

SO a have a catalog client script on change, that sets the ADDITIONAL option (not matching the ref qualifier) in case required (and I also found an way to remove it again in case the other value changes again ... ).

All works fine ... just the first time the option is to be set, it disappears again! Looks link there would be some other setting redoing what was just done in the catalg client script. I added an alert at the end of the client script and when it pops up the correct value is still there. Just overwritten with blank afterwards.

I 5 times checked ALL client scripts ... none of them can be responsible for overwriting.

And anyhow .. when changing the variable causing it .. back and force it works .. allways ... its JUST the first time this does not work ... anyone with an idea? Look more like a bug to me ... 

1 ACCEPTED SOLUTION

Table?! We are still talking about variables .. 

BUT I found it myself. Its the reference qualifier I'm using to define what kind of values are valid on the lookup select box. This technically is most probably nothing else than a client script. As the values initially are set via the change on an other variable - this will be "loaded" afterwards. So I need to remove the ref qualifyer there and buid in the logic manually within a client script.

Anyhow ! Thnx for your effort!

View solution in original post

29 REPLIES 29

So, you want to set the already selected value before this script has run ?

The script looks fine and when i try to setValue, it works fine.

How about we try to make the new option the first choice.

1. Dont set --None--

2. modify addOptions field to 

g_form.addOption('xxx_variable_B', choiceTmp , choiceTmp, 0);

 

Do put logs and check the result of 'choiceTmp'.

Is the variable 'yyy_choice_tmp' set with the correct choiceTmp?Do try a console.log(g_form.getValue('yyy_choice_tmp')); to check if the correct value is set

I tried - no difference.

But anyhow - the none need to be set, as choices otherwise always set 1st possible option. And a none is truly an option, need to keep it.

 

The additional ,0 does not seem to change anything.

And as I said earlier. The option is there! Also on the log.

Just the whole variable is somehow reloaded and the additional option is gone.

Ok, So here a few points, i can think of that might cause the selected value to disappear

1. the default value of dictionary

2. any other onchange client scripts run on the lookup select variable (since the  lookup select variable is changing)

Thnx. I'm with you. The default is not set.

But I do not find any other script ... ;-(

And even if there would be one ... when setting the order to 9999 is should run last and should work - no?

It doesn't either ...