Setting the "selected" attribute in zpt
I have a Python product with the values: self.languages = ['dk','uk'] self.language = 'uk' I am trying to rewrite a bunch of old proucts with these new-fangled PageTemplates. But I cannot seem to set the selected attribute correctly: <select name="language" class="selector"> <option tal:repeat="langItem here/languages" value="" tal:attributes="value langItem; selected python:langItem==here.language" tal:content="langItem">Language</option> </select> The rendered source looks like this: <select name="language" class="selector"> <option value="dk">dk</option> <option value="uk" selected="selected">uk</option> </select> This (selected="selected") doesn't work in the browsers. Can anyone see what I am doing wrong? -- hilsen/regards Max M Rasmussen, Denmark http://www.futureport.dk/ Fremtiden, videnskab, skeptiscisme og transhumanisme
At 06:45 AM 1/27/2003, Max M wrote:
The rendered source looks like this:
<select name="language" class="selector"> <option value="dk">dk</option> <option value="uk" selected="selected">uk</option> </select>
This (selected="selected") doesn't work in the browsers.
Can anyone see what I am doing wrong?
That code works for me in Opera and IE6... but it's not 100% correct HTML. Try: <option value="uk" selected>uk</option> Hard to imagine why an extraneous ="foo" would cause incorrect rendering, but see if that does the trick. HTH, Dylan
Hello Dylan, Monday, January 27, 2003, 4:19:54 PM, you wrote:
This (selected="selected") doesn't work in the browsers. Can anyone see what I am doing wrong?
That code works for me in Opera and IE6... but it's not 100% correct HTML.
it is 100% correct XHTML and should work fine in all recent browsers. -- Geir Bækholt geir@funcom.com Application/HCI-developer Product Operations Funcom Oslo
At 08:47 AM 1/27/2003, Geir Bækholt wrote:
Hello Dylan,
Monday, January 27, 2003, 4:19:54 PM, you wrote:
This (selected="selected") doesn't work in the browsers. Can anyone see what I am doing wrong?
That code works for me in Opera and IE6... but it's not 100% correct HTML.
it is 100% correct XHTML and should work fine in all recent browsers.
Indeed... the operative word being "should." However, the original poster says selected="selected" doesn't render correctly on his browser. I'm making the assumption that he knows well enough to say that with some authority. Since the browser wasn't specified, one has to suspect non-support for XHTML. XHTML is pretty darn close to fully backwards-compatible with HTML, but I have heard of issues, particularly with Mozilla. Oddly enough, the OP's MUA is Mozilla. Not that I've heard of any problems with *this* particular attribute... and as I said, it works on *my* browsers. I merely suggested he give the HTML syntax a try... if he came back saying that made no difference, the next suggestion would be to take a closer look to make *sure* this was the code being rendered. If that change to HTML syntax *did* make a difference... well, there's your answer right there. Feel free to jump in and share any theory you have on what else might produce this problem. Dylan
Hello Dylan, Monday, January 27, 2003, 6:37:18 PM, you wrote:
it is 100% correct XHTML and should work fine in all recent browsers.
Indeed... the operative word being "should."
However, the original poster says selected="selected" doesn't render correctly on his browser. I'm making the assumption that he knows well enough to say that with some authority.
[snip]
Feel free to jump in and share any theory you have on what else might produce this problem.
Sorry if i offended you in any way, Dylan. I was only making a statement about the valididty of selected="selected" in HTML, to correct a wrong assumption. I was in no way trying to thrash your atttempts of helping. :) I have not seen any commonly used browser that fails on that syntax, and we were several people that looked pretty hard for problems with it at the time we managed to lobby the corrrect syntax into ZPT. - but if there is indeed a backwards-compatibility-problem, someone would have to take the discussion : backwards- or forwards-compatibility first ? -- Geir Bækholt geir@funcom.com Application/HCI-developer Product Operations Funcom Oslo
At 11:15 AM 1/27/2003, Geir Bækholt wrote:
Sorry if i offended you in any way, Dylan.
No offense taken... you were making a perfectly valid point. I'm curious what the problem might be and was hoping you had thought of some other explanation.
I have not seen any commonly used browser that fails on that syntax,
Nor have I. An HTML-compliant browser shouldn't care what comes between selected and the final >. But wide-scale browser compliance has never been perfectly sensible... it usually hovers somewhere between maddening and insane. The problem may well turn out to be operator error... I typically troubleshoot by assuming the user is correct, but that's not always playing the odds correctly. :-) I suppose we'll all have more information after the original poster provides more details... Dylan
Hello Dylan, Monday, January 27, 2003, 8:45:22 PM, you wrote:
I suppose we'll all have more information after the original poster provides more details...
he has, just forgot to cc the list, probably :
But it turned out to be some kind of bug in my Mozilla Build.
:) -- Geir Bækholt geir@funcom.com Application/HCI-developer Product Operations Funcom Oslo
The rendered source looks like this:
<select name="language" class="selector"> <option value="dk">dk</option> <option value="uk" selected="selected">uk</option> </select>
This (selected="selected") doesn't work in the browsers.
Can anyone see what I am doing wrong?
Which browsers does it not work in? I'm using the exact same TAL syntax and get the same output. But none of the following browsers have complain: Opera6, windows Opera7, windows Phoenix, windows IE6, unix :) I've read that too that this _should_ be ok, but concerned now that you say that some browsers have problems with it. Peter
I think this was resolved and it turned out that the original poster had a faulty build of Mozilla. At 11:53 AM 1/30/2003, Peter Bengtsson wrote:
The rendered source looks like this:
<select name="language" class="selector"> <option value="dk">dk</option> <option value="uk" selected="selected">uk</option> </select>
This (selected="selected") doesn't work in the browsers.
Can anyone see what I am doing wrong?
Which browsers does it not work in? I'm using the exact same TAL syntax and get the same output. But none of the following browsers have complain: Opera6, windows Opera7, windows Phoenix, windows IE6, unix :)
I've read that too that this _should_ be ok, but concerned now that you say that some browsers have problems with it.
Peter
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (5)
-
Dylan Reinhardt -
Dylan Reinhardt -
Geir Bækholt -
Max M -
Peter Bengtsson