ajax refreshed Select field has no data on insert

Hello,

I have two select fields on a form and the value of the first one determines the value of the second one and refreshes it on an ajax onChange event set in the fields settings, not a seperate ajax event. However, when in insert mode the second select field is empty until I click the first field and change it. The addition of the new record is to one table and the values of the select fields are from another table. The values from the select fields in the second table are inserted and associated with the new record I’m creating in the first table. If I wanted the first value in the first select I have to change it back and the second select field then reloads. What can I put in the onBeforeInsert event that would make the first select field refresh the second select field?

Thanks

My long winded explanation might be confusing so here are some screen shots.

Initial form on insert

Form after field1 is changed

screenshot1.jpg

screenshot2.jpg

Yo tengo el mismo problema, no se si alguien ha conseguido que se lo solucione

[QUOTE=ancr2001;13596]My long winded explanation might be confusing so here are some screen shots.

Initial form on insert

Form after field1 is changed
[/QUOTE]

Tambien estoy con este problema.

Yes, I have the same.
I think this is because SQL in second field is triggered when you change the first.

Also it would be great if you could set drop-down type field in “empty mode” so in the beginning it would show “choose something…” instead of taking first record from DB.

You can…

Go to lookup section and check the radiobutton ‘use title’. Then enter ‘*** please select ***’ into title field and a silly value in the internal value. In the onvalidate you need to check the silly value to be sure that someone has changed the value to a valid one.

the second lookupvalue is triggered by an onchange event. And if the field is initially filled then this trigger does not fire…

1 Like

Thanks a lot!
That was what I needed.

i have a problem which is mostly like the one here, so i dont open a new thread.

i have a lot of selectsfields. all are handling with the same table. i want that the select-fields dont show an item, whis is allready selected from another field.

my sql is like this:

SELECT
mailvorlagentxt.id,

SUBSTRING(CONCAT(mailvorlagennamen.Bezeichnung, " - ",mailvorlagentxt.Text), 1, 75)
FROM
mailvorlagennamen INNER JOIN mailvorlagentxt ON mailvorlagennamen.id = mailvorlagentxt.Bez
WHERE mailvorlagentxt.bez not IN ([where])

ORDER BY
mailvorlagennamen.Bezeichnung, mailvorlagentxt.Text

please ignore the most od the statement - it works. take a look at the “where”:

WHERE mailvorlagentxt.bez not IN ([where])

so now. if i try it and set in the onload-event something like

[where]=“1,4,9”;

it works pretty well: every selct shows the items i want, no select has one of the “1”, “4” or “9” items in it.

but when i do the following, sc doesnt behave like i think it should:

  1. i call an onchange-event on every select field

  2. there, in the onchange-event i re-build the [where] variable and insert everything which is used in the select-fields

  3. i put ajax reload field feature on every select-field.

this doesnt work. do you know why or how i can solve this?

Ajax processing doesn’t work

[QUOTE=aducom;19914]You can…

Go to lookup section and check the radiobutton ‘use title’. Then enter ‘*** please select ***’ into title field and a silly value in the internal value. In the onvalidate you need to check the silly value to be sure that someone has changed the value to a valid one.

the second lookupvalue is triggered by an onchange event. And if the field is initially filled then this trigger does not fire…[/QUOTE]

Wonderful Aducom. This is an excellent solution. Regards.

You can also try to select the option “Reload form when value has changed” which is below the Title in Lookup Settings of Select field.
I have noticed that Ajax solutions in SC sometimes freaking out.