Mike Looijmans
nlv11281 at natlab.research.philips.com
Mon Jun 12 04:51:14 EDT 2006
The way your code looks in my mailer, the indentation is flawed. It should be like this (indenting the HTML is not needed but makes it better readable): ... <select name="Elenco"> <% for i in range(50, 350, 50): if 'Elenco' in form and int(form['Elenco'])==i: sel='selected' else: sel='' # end if %> <option value="<%=i%>" <%=sel%> > <%=i%> </option> <% # end for %> </select> <input type="submit" value="acquisizione"/> ... Mike Looijmans Philips Natlab / Topic Automation ziapannocchia at gmail.com wrote: > In the code at the and of the post, the for instruction flux depends > from the nested if. > > Behaviour expected: for any item, the for instruction executes the if > instruction and > write the option tag. > > Real behaviour: the for instruction runs well only if the control in > the if instruction fails. If the control is true, the flux jumps to the > next item and the option tag is not printed on html output. > > I need to understand if that depends from a bad indentation or if > structures with more than one ":" are not supported in psp. > > Sorry for my english. > > [code] > <html> > <form> > <select name="Elenco"> > <!--genera elenco usando un loop --> > > <% > for i in range(50, 350, 50): > if 'Elenco' in form and int(form['Elenco'])==i: > sel='selected' > else: > sel='' > # > %> > <option value="<%=i%>" <%=sel%> > > <%=i%> > </option> > <% > %> > </select> > <input type="submit" value="acquisizione"/> > </form> > </html> > [/code] > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python >
|