﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18733	Form ids on as_table	tturner	nobody	"When you render a form as a table in a template it does the following.


{{{
<tr><th><label for=""id_component_a"">Component A:</label></th><td><input type=""checkbox"" name=""component_a"" id=""id_component_a""></td></tr>
}}}


The problem is if I want to change the CSS or access certain parts in JavaScript I can't. So what I have done is added an id to each part.


{{{
<tr id=""_tr_id_component_a""><th id=""_th_id_component_a""><label for=""id_component_a"">Component A:</label></th><td id=""_td_id_component_a""><input type=""checkbox"" name=""component_a"" id=""id_component_a""></td></tr>
}}}


so now the tr, th, td tag has an id.


The code I had to change was.


{{{
def as_table(self):
        ""Returns this form rendered as HTML <tr>s -- excluding the <table></table>.""
        return self._html_output(
            normal_row = u'<tr%(html_class_attr)s id=""_tr_%(id)s""><th id=""_th_%(id)s"">%(label)s</th><td id=""_td_%(id)s"">%(errors)s%(field)s%(help_text)s</td></tr>',
            error_row = u'<tr><td colspan=""2"">%s</td></tr>',
            row_ender = u'</td></tr>',
            help_text_html = u'<br /><span class=""helptext"">%s</span>',
            errors_on_separate_row = False)
}}}


I also had to pass the id to the routine

If you want a patch I can create one


"	New feature	closed	Forms	1.4	Normal	wontfix			Unreviewed	0	0	0	0	0	0
