Forum Moderators: open
The second one, choices.html, is used to let the user choose an item and contains:
* a "readonly" input box called 'price'
* a select box called 'item', which options are a list of items in the form "Item name - price"
* a link called 'add_new_item_on_the_fly" which opens a new window containing add_new_item.html
'item' select box has an onchange event attached that calls a function called update_input_box. This function take the price of the selected item and updates the input box accordlingly when the user choose a different item.
The machinery works perfectly when a new item is added from add_new_item.html: 1) a new item is added using add_new_item.html, 2) opening choices.html the new item appears inside the select box and it is selectionable; 3) when the status of select box changes, input box changes its value.
The machinery doesn't work when the new item is added using the link: 1) once clicked on the link a new page is opened, the content is the same page used before, add_new_item.html; 2) after have submitted details for the new item, the page is automatically closed; 3) new item appears inside the selectbox; 4) input box *is not* automatically updated reflecting the new value.
So, does onchange event work only when the user triggers the change?
Thanks for any thought,
paolo
From what you are saying, it looks like the onchange event is only fired by an actual user interaction with the select box.
You could make both the select's onchange event, and your own scripted-link action, trigger a common function that does what you want (..?)