Update select display when selection changed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Update select display when selection changed

Bob Nemec
Hello,
How do I get the rendered display of a drop-down select list to show an updated selection from another session?

Here is the scenario: I have a domain object with an attribute displayed in a drop-down list.  Some other session updates the attribute.  I refresh my display, but the rendered selection does not change.  Using Firebug, the generated html shows the updated selection.  This may be basic HTML knowledge, but should the displayed value not update to show the changed 'selected' option?  Or is the value intended to be set only on the initial page display and then only by a user action?

Here is an example.  I have a demo Seaside component with a class variable #testStateListSelection which is selected to 'one' in a Seaside session.  If I change the value to 'three'  in another Seaside session, the displayed value stays as 'one' in the original session after rendering again, even though the "selected" in the generated HTML shows "three".

renderSelectionListOn: html
html form: [
html select 
list: #('one' 'two' 'three' 'four' 'five'); 
selected: self class testStateListSelection; 
callback: [:value | self class testStateListSelection: value].
html break.
html submitButton
callback: [Transcript cr; show: self class testStateListSelection];
with: 'Save']

...the displayed value shows 'one', even though the HTML is...

<select name="1">
  <option value="1">one</option>
  <option value="2">two</option>
  <option value="3" selected="selected">three</option>
  <option value="4">four</option>
  <option value="5">five</option>
</select><br>

How do I get the drop-down selected value to show 'three'? 

BTW: all I know about HTML & browser behaviour I've learned from coding Seaside, so I may have a skewed perspective ;-)  

Thanks for any help,
Bob Nemec


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec
Reply | Threaded
Open this post in threaded view
|

Re: Update select display when selection changed

littleSmalltalker
Bob,
Looks like it's a browser issue,
since the actual HTML is updated. This is sometimes caused by browsers that do not update the display regardless of the actual markup (they assume it's the same). Internet Explorer may do this from time to time.

You should create a Javascript code that updates the select element.


Regards,
Avi.

On Mon, Jan 31, 2011 at 3:07 PM, Bob N. <[hidden email]> wrote:
Hello,
How do I get the rendered display of a drop-down select list to show an updated selection from another session?

Here is the scenario: I have a domain object with an attribute displayed in a drop-down list.  Some other session updates the attribute.  I refresh my display, but the rendered selection does not change.  Using Firebug, the generated html shows the updated selection.  This may be basic HTML knowledge, but should the displayed value not update to show the changed 'selected' option?  Or is the value intended to be set only on the initial page display and then only by a user action?

Here is an example.  I have a demo Seaside component with a class variable #testStateListSelection which is selected to 'one' in a Seaside session.  If I change the value to 'three'  in another Seaside session, the displayed value stays as 'one' in the original session after rendering again, even though the "selected" in the generated HTML shows "three".

renderSelectionListOn: html
html form: [
html select 
list: #('one' 'two' 'three' 'four' 'five'); 
selected: self class testStateListSelection; 
callback: [:value | self class testStateListSelection: value].
html break.
html submitButton
callback: [Transcript cr; show: self class testStateListSelection];
with: 'Save']

...the displayed value shows 'one', even though the HTML is...

<select name="1">
  <option value="1">one</option>
  <option value="2">two</option>
  <option value="3" selected="selected">three</option>
  <option value="4">four</option>
  <option value="5">five</option>
</select><br>

How do I get the drop-down selected value to show 'three'? 

BTW: all I know about HTML & browser behaviour I've learned from coding Seaside, so I may have a skewed perspective ;-)  

Thanks for any help,
Bob Nemec


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Update select display when selection changed

Bob Nemec
Yes, it is indeed a browser issue.  I should have tested a bit more... the problem only comes up in Firefox (I'm using 3.6.13). 
Chrome, IE and Opera work fine.

I've posted this on stackoverflow (first time); I'm curious to see how that works.  Might not be a bad place for Seaside questions, given how many tech specialities the questions can apply to.  And no harm in getting a bit more exposure to Seaside & Smalltalk.

On Mon, Jan 31, 2011 at 8:24 AM, Avi Shefi <[hidden email]> wrote:
Bob,
Looks like it's a browser issue,
since the actual HTML is updated. This is sometimes caused by browsers that do not update the display regardless of the actual markup (they assume it's the same). Internet Explorer may do this from time to time.

You should create a Javascript code that updates the select element.


Regards,
Avi.

On Mon, Jan 31, 2011 at 3:07 PM, Bob N. <[hidden email]> wrote:
Hello,
How do I get the rendered display of a drop-down select list to show an updated selection from another session?

Here is the scenario: I have a domain object with an attribute displayed in a drop-down list.  Some other session updates the attribute.  I refresh my display, but the rendered selection does not change.  Using Firebug, the generated html shows the updated selection.  This may be basic HTML knowledge, but should the displayed value not update to show the changed 'selected' option?  Or is the value intended to be set only on the initial page display and then only by a user action?

Here is an example.  I have a demo Seaside component with a class variable #testStateListSelection which is selected to 'one' in a Seaside session.  If I change the value to 'three'  in another Seaside session, the displayed value stays as 'one' in the original session after rendering again, even though the "selected" in the generated HTML shows "three".

renderSelectionListOn: html
html form: [
html select 
list: #('one' 'two' 'three' 'four' 'five'); 
selected: self class testStateListSelection; 
callback: [:value | self class testStateListSelection: value].
html break.
html submitButton
callback: [Transcript cr; show: self class testStateListSelection];
with: 'Save']

...the displayed value shows 'one', even though the HTML is...

<select name="1">
  <option value="1">one</option>
  <option value="2">two</option>
  <option value="3" selected="selected">three</option>
  <option value="4">four</option>
  <option value="5">five</option>
</select><br>

How do I get the drop-down selected value to show 'three'? 

BTW: all I know about HTML & browser behaviour I've learned from coding Seaside, so I may have a skewed perspective ;-)  

Thanks for any help,
Bob Nemec


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec
Reply | Threaded
Open this post in threaded view
|

Re: Update select display when selection changed

Julian Fitzell-2
Several Seaside developers actively monitor StackOverflow for
questions tagged with seaside. I encourage other readers of the list
to do so as well. As you say, it's a good way to increase exposure and
make questions and their answers easier to find than through the list
archives.

Julian

On Tue, Feb 1, 2011 at 12:38 PM, Bob N. <[hidden email]> wrote:

> Yes, it is indeed a browser issue.  I should have tested a bit more... the
> problem only comes up in Firefox (I'm using 3.6.13).
> Chrome, IE and Opera work fine.
> I've posted this on stackoverflow (first time); I'm curious to see how that
> works.  Might not be a bad place for Seaside questions, given how many tech
> specialities the questions can apply to.  And no harm in getting a bit more
> exposure to Seaside & Smalltalk.
> On Mon, Jan 31, 2011 at 8:24 AM, Avi Shefi <[hidden email]> wrote:
>>
>> Bob,
>> Looks like it's a browser issue, since the actual HTML is updated. This is
>> sometimes caused by browsers that do not update the display regardless of
>> the actual markup (they assume it's the same). Internet Explorer may do this
>> from time to time.
>>
>> You should create a Javascript code that updates the select element.
>>
>>
>> Regards,
>> Avi.
>>
>> On Mon, Jan 31, 2011 at 3:07 PM, Bob N. <[hidden email]> wrote:
>>>
>>> Hello,
>>> How do I get the rendered display of a drop-down select list to show an
>>> updated selection from another session?
>>> Here is the scenario: I have a domain object with an attribute displayed
>>> in a drop-down list.  Some other session updates the attribute.  I refresh
>>> my display, but the rendered selection does not change.  Using Firebug, the
>>> generated html shows the updated selection.  This may be basic HTML
>>> knowledge, but should the displayed value not update to show the changed
>>> 'selected' option?  Or is the value intended to be set only on the initial
>>> page display and then only by a user action?
>>> Here is an example.  I have a demo Seaside component with a class
>>> variable #testStateListSelection which is selected to 'one' in a Seaside
>>> session.  If I change the value to 'three'  in another Seaside session, the
>>> displayed value stays as 'one' in the original session after rendering
>>> again, even though the "selected" in the generated HTML shows "three".
>>> renderSelectionListOn: html
>>> html form: [
>>> html select
>>> list: #('one' 'two' 'three' 'four' 'five');
>>> selected: self class testStateListSelection;
>>> callback: [:value | self class testStateListSelection: value].
>>> html break.
>>> html submitButton
>>> callback: [Transcript cr; show: self class testStateListSelection];
>>> with: 'Save']
>>> ...the displayed value shows 'one', even though the HTML is...
>>> <select name="1">
>>>   <option value="1">one</option>
>>>   <option value="2">two</option>
>>>   <option value="3" selected="selected">three</option>
>>>   <option value="4">four</option>
>>>   <option value="5">five</option>
>>> </select><br>
>>> How do I get the drop-down selected value to show 'three'?
>>> BTW: all I know about HTML & browser behaviour I've learned from coding
>>> Seaside, so I may have a skewed perspective ;-)
>>> Thanks for any help,
>>> Bob Nemec
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Update select display when selection changed

Bob Nemec
In reply to this post by Bob Nemec
On Stack Overflow Lucas suggested coding...

 html form noAutocomplete; with: [ ...

...which fixed the problem nicely on Firefox. 

Thanks.

On Mon, Jan 31, 2011 at 8:07 AM, Bob N. <[hidden email]> wrote:
Hello,
How do I get the rendered display of a drop-down select list to show an updated selection from another session?

Here is the scenario: I have a domain object with an attribute displayed in a drop-down list.  Some other session updates the attribute.  I refresh my display, but the rendered selection does not change.  Using Firebug, the generated html shows the updated selection.  This may be basic HTML knowledge, but should the displayed value not update to show the changed 'selected' option?  Or is the value intended to be set only on the initial page display and then only by a user action?

Here is an example.  I have a demo Seaside component with a class variable #testStateListSelection which is selected to 'one' in a Seaside session.  If I change the value to 'three'  in another Seaside session, the displayed value stays as 'one' in the original session after rendering again, even though the "selected" in the generated HTML shows "three".

renderSelectionListOn: html
html form: [
html select 
list: #('one' 'two' 'three' 'four' 'five'); 
selected: self class testStateListSelection; 
callback: [:value | self class testStateListSelection: value].
html break.
html submitButton
callback: [Transcript cr; show: self class testStateListSelection];
with: 'Save']

...the displayed value shows 'one', even though the HTML is...

<select name="1">
  <option value="1">one</option>
  <option value="2">two</option>
  <option value="3" selected="selected">three</option>
  <option value="4">four</option>
  <option value="5">five</option>
</select><br>

How do I get the drop-down selected value to show 'three'? 

BTW: all I know about HTML & browser behaviour I've learned from coding Seaside, so I may have a skewed perspective ;-)  

Thanks for any help,
Bob Nemec



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec