A certainl part of an if() structure never gets executed.

feedthetroll at gmx.de feedthetroll at gmx.de
Wed Jun 12 07:07:42 EDT 2013


Am Mittwoch, 12. Juni 2013 12:07:54 UTC+2 schrieb Andreas Perstinger:
> [Please trim your replies to the relevant parts.]
> On 12.06.2013 10:54, Νικόλαος Κούρας wrote:
> > But when it comes to select '==========' from month instead of
> > '==========' to be submitted a zero gets submitted and i think the
> > problem is the way i'm filling up months into the drop down menu which is:
> 
> > for i, month in enumerate(months):
> >       print('<option value="%s"> %s </option>' % (i, month) )
> >
> > the if case does not execute because of the way it checks for None entry
> > which is: elif '=' not in year:
> > but if enumerate yields 0 instead of '==========' then elif '=' not in
> > year of course fails.
> 
> How often do we need to tell you that you should reread your posts 
> before sending them?
> You start with telling us you have problems with "month" and then show 
> us code regarding "year"
> 
> > So, i must tell:
> >
> > for i, month in enumerate(months):
> >       print('<option value="%s"> %s </option>' % (i, month) )
> >
> > to somehow return '==========' instead of 0 but don't know how.
> 
> As with most of your problems you are barking up the wrong tree.
> Why not use the actual value you get from the form to check whether you 
> have a valid month?
> 
> Do you understand why "0" is submitted instead of "=========="?
> 
To Nikos:
My I elaborate that for you:
Your form contains: <option value="0"> ========== </option>
If you still don't know why you get "0" read:
  http://www.w3schools.com/tags/att_option_value.asp (or something in
  greek about html forms)
(Sorry, I know, you do not read doks, because they describe what the software
DOES and not what you WANT it to DO)

So this is no python problem, it is a html-problem.



More information about the Python-list mailing list