Checkboxes disappear when materializecss is applied (using django) - html

The code with the css makes the checkboxes disappear for cash.
They have been initialised as boolean variables in the model(using django).
<table>
<thead>
<tr>
<th>Payment Method:</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ seller_event_form.cash_payment }}</td>
</tr>
</tbody>
</table>
Without the css, the checkboxes appear. Because of this, none of the data inputted gets stored in the database.
edit with more info
I'm trying to unpack a model form here. When I unpack without adding any css, the boolean value in the model gets converted to a checkbox in the html. However, when I add css, the checkbox disappears. What am I doing wrong?

Related

How to correctly handle table with rows which serves as list opening listed objects by WCAG

I have a list of books displayed as table and javascript code which handles highlight on its rows. When I click some row I can select it, by doubleclick or enter it will open new tab with that book details.
I am wondering how it will be correctly coded by WCAG standards? To be usable by screen readers, e.g. NVDA?
I looked at WCAG standards but I can't find this type of usage.
<table>
<tr>
<th>Author</th>
<th>Name</th>
<th>ISBN</th>
<th>Year</th>
<th>Number of Pages</th>
</tr>
<tr>
<td>John</td>
<td>How to be awesome</td>
<td>456987</td>
<td>1950</td>
<td>1</td>
</tr>
<tr>
<td>James</td>
<td>Two is Two too</td>
<td>654654</td>
<td>2010</td>
<td>520</td>
</tr>
</table>
Right now opening of detail and row focus is handled by JavaScript, user can move through rows using arrows up/down and open detail by Enter.
Should I:
1) add tabIndex to ?
2) add element to row?
3) do not modify table at all and try to edit JS so it can be used by screen reader too?
4) add element to row?
5) anything else?
You should follow the grid pattern as defined in the "WAI-ARIA Authoring Practices 1.1". A grid is a table that you can interact with.
Also note in your code sample, you should have a <th scope="row"> for each row of data. That will help when a screen reader user navigates vertically down a column. It's up to you to decide which cell makes the most sense as a row header. My first choice would be the book name.

What is the best way to get a form row into a table?

I'm building an app that displays a table with some information. I want the user to be able to click on the cells and have a row slide out below it containing a form in which an action can be made.
so it would look like this:
<table>
<tr>
<td>some info 1</td>
<td>some info 2</td>
<td>some info 3</td>
</tr>
<tr>
<form> some form that spans the entire row + submit button </form>
</tr>
</table
The form would be hidden and by clicking on one of the cells the form would slide down.
The problem i'm facing is that it is not possible to render a form as a table row. I have read multiple sources that say it can't be done. I can render it inside a single cell but the form is too big for that.
One solution i read would be to wrap the entire table with a form tag and have multiple submit buttons. This to me feels like bad practice and I'm not sure it would work.
I've also looked into recreating the table with div's however every solution i find uses 'display: table' which has the exact same problem.
What is the best way to handle this? (i'm using Ruby on Rails)
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<form action="">
<td colspan="3"><input type="text"></td>
</form>
</tr>
</table>
have you tried using colspan?
My advice is to replace table with divs if your project allows you to do it. You can use bootstrap (https://getbootstrap.com/examples/grid/) for making this easier.
Why:
1. Cleaner code
2. You can manipulate the divs easier than table raws/cells...
3. You can duplicate div as fast as tr .
Give it a try and than take your decision.

code reusability in HTML

I have three tables which are using using different variables for displaying the data.
Basic structure of the table
<table>
<thead>
<tr>
<th ng-repeat="var in array2"><i ng-show="array3[$index]=0"></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="var in variable">
<td ng-repeat="var1 in var">{{var1.position}}</td>
</tr>
</tbody>
</table>
All the three tables are using different arrays for variable, array2 and array3. Is there any way I don't have to write the code thrice and I can loop the code for three tables.
Please suggest changes in data structures only when there are no other possible HTML solution to change it.
You need to check for directives, for instance <my-table-directive datas="array1"></my-table-directive>
This directive will hold the logic and templaces and you'll pass a variable to define the content.

Pre-render angular's template to re-use them

I have an HTML structure with a list of tables like this
<div ng-repeat="row in rows">
<table>
<td ng-repeat="row2 in rows2">
<tr ng-repeat="col in cols">
{{blablabla}}
</tr>
</td>
</table>
</div>
The table is always quite the same, but Angular just redraw it every times (for each elements in 'rows'), which leads to some performance issues.
Is there a way to tell angular to pre render the table in the middle, and then display the list ?

GWT wrap a html table and add cels

I'm using gwt in my web app and I have a html panel which contains a <table>. I've chosen to do this instead of flextable due to some annoying issues when styling it as being unable to do <tbody valign="top">.
I wanted to know if it's possible to wrap a html table
<table>
<thead>
<tr>
<th>Name</th>
<th>Path</th>
<th>Type</th>
</tr>
</thead>
</table>
In a class like Flextable so I can easily control rows and columns through Java?
Something like
Label.wrap("id");
but for tables.
You can also format your data in FlexTable.
You can use flexTable.getRowFormatter(), flexTable.getColumnFormatter() or flexTable.getColumnFormatter().
You can apply alignment, style to rows, columns and cells using above FlexTable attributes.
Please provide a standalone test case if you are facing any problems with FlexTable.