am trying to develop a basic form using polymerjs.
using iron-forms element alone i was able to create a form using the
second example in the following link reference :
https://elements.polymer-project.org/elements/iron-form?view=demo:demo/index.html&active=iron-form
but am not able to incorporate this with normal html table.
what i want to create is to make each input within the table cells seperately, similar as follows:
<form is="iron-form" method="get" action="/" id="submitOptions">
<table style="width: 95%;" align= "center">
<tr>
<td style="width: 50%;text-align: left;">
<paper-input name="User Name" label="User Name" required auto-validate autofocus style="width: 70%;" error-message="Username is required"> </paper-input>
</td>
<td style="width: 50%;c">
<paper-input label="Employer (Optional)" style="width: 70%;">
</paper-input>
</td>
</tr>
<tr>
<td style="width: 50%;text-align: left;">
<paper-input name="password" label="Password" type="password" required char-counter maxlength="10" style="width: 70%;" auto-validate allowed-char-counter minlength="6" error-message="Must be at least 6 characters."></paper-input>
</td>
</tr>
<div class="card-actions">
<tr>
<td colspan="2" align="center"
</br> <paper-button raised onclick="_submit(event)">Submit</paper-button>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<paper-button raised onclick="_reset(event)">Reset</paper-button>
</td>
</tr>
</div>
<tr>
<td colspan="2" align="center">
<div class="output"></div>
</td>
</tr>
</table>
</form>
script code:
<script>function _submit(event) {
Polymer.dom(event).localTarget.parentElement.submit(); }function _reset(event) {
var form = Polymer.dom(event).localTarget.parentElement
form.reset();
form.querySelector('.output').innerHTML = ''; }submitOptions.addEventListener('iron-form-submit', function(event) {
this.querySelector('.output').innerHTML = JSON.stringify(event.detail);}); </script>
I think you should avoid using tables for layout purposes and use the iron-flex-layout or flexboxes themselves.
This will also help you achieve a responsive layout, i.e. a layout that will change depending on screen size.
See this question: How do I use flexbox together with Polymer to make tables
Guides:
iron-flex-layout: https://elements.polymer-project.org/guides/flex-layout
flexboxes: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Exerpt from http://www.w3schools.com/html/html_layout.asp
"HTML Tables The element was not designed to be a layout tool!
The purpose of the element is to display tabular data. So, do
not use tables for your page layout! They will bring a mess into your
code. And imagine how hard it will be to redesign your site after a
couple of months.
Tip: Do NOT use tables for your page layout!"
w3schools.com has got some guides on how to use bootstrap which will help you as well. I find bootstrap trickier than just using flexboxes myself so far.
So I suggest you have a read up on the alternatives and edit your question or submit a new question when you run into problems with the alternative you have gone for!
Hope it helps.
Related
This question already has answers here:
Disable text input history [duplicate]
(2 answers)
Closed 4 years ago.
I have a simple problem. How do I code a line to clear the search input history whenever I want to type in something new into the search box? I am writing a form which interacts with the YouTube search bar so whatever I type inside the search box, it will link to YouTube.
Below is the image file in which shows the input history I have typed in and it does not clear whenever I refresh the browser. I am fairly new at html.
Search Input :
<table class="tborder" cellpadding="$stylevar[cellpadding]"
cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="right">
<tr>
<td class="thead" width="100%">
<div style="text-align: left;">
<strong>YouTube Search</strong>
</div>
</td>
</tr>
<tr>
<td class="alt1" width="100%">
<div class="smallfont" style="text-align: left;">
<form id="vb_yt_search-form" action="http://www.youtube.com/results" method="get" target="_blank">
<input id="vb_yt_search-term" name="search_query" type="text" maxlength="128" />
<select name="search_type">
<option value="" >Videos</option>
<option value="search_users">Channels</option>
</select>
<input type="submit" value="Search" />
</form>
</div>
</td>
</tr>
</table>
You should use attribute autocomplete="off"
The best way is
<form autocomplete="off">
</form>
Hope that helps
I am facing issue when working with NgTableParams to show table in IE.
It is showing correctly in chrome but the table row alignment is not proper in IE.
Please find the demo https://plnkr.co/edit/NAi4ZIleQ2LWDWHQbjS5?p=preview
In IE when you open the above link and Launch the preview window in separate page, you can notice the table rows are not properly matching with the table header.Any inputs?
html:
<div ng-controller="BaseController">
<div class="col-xs-5 container-paragraph">
<table ng-table="tableParams" class="table table-striped table-scroll" show-filter="true">
<tr ng-repeat="user in $data">
<td title="'Name'" filter="{ firstname: 'text'}" sortable="'firstname'">
{{user.firstname}}</td>
</tr>
</table>
</div>
<div class="col-xs-7 container-paragraph">
<table ng-table="tableParams" class="table table-striped table-scroll" show-filter="true">
<tr ng-repeat="user in $data">
<td title="'Name'" filter="{ firstname: 'text'}" sortable="'firstname'">
{{user.firstname}}</td>
</tr>
</table>
</div>
</div>
Pls find the image which shows the alignment of rows with the header issue in IE below:
Put both tables inside a single table and try
may this code help you
<td data-title="'#'" sortable="'id'">
{{$index + 1}} </td>
you can name your fields using data-title in ng-table
<input type="text" class="form-control input-sm pull-right ng-pristine ng-valid ng-touched"
ng-model="" placeholder="">
and search button seperatelly
I am loading an Ajax form with Smarty and jQuery.
It should load this:
{foreach $topFEED as $article}
<tr>
<td><form action='postbox.php' method='POST'></td>
<td><img class="favicon_prev" src="http://www.google.com/s2/favicons?domain={$article.img_link}"> <input type="text" name="link" style="width: 300px;" value="{$article.link}" READONLY/></td>
{if $loggedin}<td><input type='submit' id="abo" name="submit" value='Abonnieren' /></td>
<input type='hidden' name="action" value='add_feed' READONLY />{/if}
<td></form></td>
</tr>
{/foreach}
Ajax Code:
$.ajax({
type: 'GET',
url: "article.php?method=top_feeds",
dataType: 'html',
})
.done(function(html) {
$("#ajax_top_feeds").replaceWith(html);
});
Result:
<tr>
<td><form action="postbox.php" method="POST"></form></td>
<td><img class="favicon_prev" src="http://www.google.com/s2/favicons?domain=http://www.n-tv.de"> <input type="text" name="link" style="width: 300px;" value="http://www.n-tv.de/rss" readonly=""></td>
<td><input type="submit" id="abo" name="submit" value="Abonnieren"></td>
<input type="hidden" name="action" value="add_feed" readonly=""> <td></td>
</tr>
Your HTML is invalid, the browser is simply correcting it for you. form elements can't cross multiple table cells like that.
You can wrap a form around your entire table:
<form>
<table>
<!--- etc. --->
</table>
</form>
Or you can place a form inside of a table cell:
<table>
<tr>
<td>
<form>
<!--- etc. --->
</form>
</td>
</tr>
</table>
But you can't begin a form in one cell and end it in another. The hierarchy of HTML markup isn't structured that way. Tags must be closed before parent tags are closed.
I am working on a project. You can access to the page here
Here is the small bit where the error happens
<div class="col-sm-6 responsive-table">
<table>
<caption>Page template</caption>
<tr >
<td class='leftCol'>Easy</td>
<td ><input ng-model='page.easy' ng-model='wordpress' min=0 type='number' class='form-control numberInput' ></td>
</tr>
<tr >
<td >Medium</td>
<td ><input ng-model='page.medium' type='number' min=0 class='form-control numberInput'></td>
</tr>
<tr >
<td class='leftCol'>Hard</td>
<td ><input ng-model='page.hard' type='number' min=0 class='form-control numberInput'></td>
</tr>
</table>
</div>
<div class="col-sm-6 responsive-table">
<table>
<caption>Frontpage template</caption>
<tr >
<td class='leftCol'>Easy</td>
<td><input ng-model='frontpage.easy' type='number' min=0 class='form-control numberInput'></td>
</tr>
<tr >
<td >Medium</td>
<td><input ng-model='frontpage.medium' type='number' min=0 class='form-control numberInput'></td>
</tr>
<tr >
<td class='leftCol'>Hard</td>
<td><input ng-model='frontpage.hard' type='number' min=0 class='form-control numberInput'></td>
</tr>
</table>
</div>
</div>
When I clicked the input text boxes in the app, the whole group moves. Anyone knows why?
At first I thought it would be because of data-toggle tooltip. I tried to fix with adding container body to the element but it just does not work. I think it is not because of the tooltip because I even removed the tooltip stuffs but it still does not work.
Thank you for reading! Any answers, tips or suggestions is welcome.
I tried it in chrome and saw no offsets when clicking in. This might be due to css issuses. Note that angular modifies the input's class when you click in it, outside, change value etc. Some of the classes that are modified are:
ng-pristine, ng-dirty, ng-valid, ng-invalid, ng-touched (there are probably more).
If your css has a definition that changes the element size, for example a different border for an active object, it might generate such effect.
One way to track the issue would be to use chrome and do the following:
1. Right click the field and select 'inspect elemenet'
2. The DevTools window opens, now click in and out of the input element and see what classes are changed, the DevTools animate the changes for you and you will have a visual cue.
3. See what definitions might be affecting the layout.
I have three columns in a table. 1st and 3rd column have plenty of rows. 2nd column has only row, but i want this row to be located in middle of table. I am not getting desired result.
<tr>
<td>
<div id="Usrs">
<select name="z" id="z" size="25" multiple="multiple" style="width: 200px">
<option>abc</option>
</select>
</div>
</td>
<td colspan="2" align="center" valign="middle">
Move
</td>
<td>
<div id="Usrs">
<select name="z" id="z" size="25" multiple="multiple" style="width: 200px">
<option>abc</option>
</select>
</div>
</td>
</tr>
Attached the image also. Help me where am I going wrong
Use "vertical-align:" instead of "valign:"
style="vertical-align: middle"
http://www.css4you.de/Texteigenschaften/vertical-align.html
Try to add a div or span tag, and mention the width and height in it.