html - Boolearn logic in Python CGI script -


does know how set html check box true or false python. using python file parse xml file list. list want check checkbox if text in xml tag 1 or want remain unchecked if the text in xml tag 0.

thsi being done cgi file, don't ask why. is. can't use frameworks device small amount of memory.

the list have parses xml file list, part works.

 <label class="checkbox inline control-label"><input name="l10" value="l10" checked="checked" type="checkbox"      <span> l10  &nbsp;&nbsp;&nbsp;</span></label>      <label class="checkbox inline control-label"><input name="l05" value="1" type="checkbox" checked/>  <span> l5  &nbsp;&nbsp;&nbsp;</span></label> 

can like:

if config_settings.settings[11] == '1':     true 

or put logic html form like:

<label class="checkbox inline control-label"><input name="l05" if config.settings.settings[11] == '1':     <input name="l05" value="1" type="checkbox" checked/> 

any appreciated.

i shown solution using php similiar. answer worked me in end simple enough. changed setting in xml file 1 or 0 true or false , did this:

if config_settings.settings[5] == '1':      print'''<html><label class="checkbox inline control-label"><input name="aweight" value="1" type="checkbox" checked/></html>''' else:     print'''<html><label class="checkbox inline control-label"><input name="aweight" value="1" type="checkbox"/></html>''' 

the html inside python cgi script.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -