Seaside: list that loses its content when updated

It is really easy. I have a <select> and I want to update some internal state based on the selection. No need to redraw anything. The problem is that after selecting and querying the AJAX list, the list is written off.

 renderContentOn: html |value myId| html form with: [ html select list: #('one' 'two' 'tree' 'four' 'five'); id: (myId := html nextId); callback: [ :v | value := myId ]; onChange: ( html prototype updater triggerFormElement: myId; callback: [:h | value "do something with the value here"]; return: false ). ] 
+4
source share
2 answers

#updater requires the DOM identifier of the item being updated. If you were unable to provide an identifier, the default value is this , the DOM element raises an event. Thus, you get an empty list. If you do not need to update something, you should use #request instead of #updater . If you want to update something, you need to provide a valid identifier using #id:

Read the AJAX section : Speaking of the server in the Seaside Book, he explains AJAX in detail.

+3
source

Since the updater replaces the html of the element, it was defined with the content generated by the callback, and your callback does not generate any html, this list is empty, I think.

+1
source

Source: https://habr.com/ru/post/1339565/


All Articles