Invalid code snippets in XHTML1.0 - xhtml

Can anyone advise why the following is not valid strict xhtml 1.0?
<p align="right">
<table align="right">
<form name="login" action="/scripts/login.cgi" method="post">

align attribute is presentational and replaced by CSS.
Paragraphs may not contain tables.
Forms may not be child nodes of tables.
name attribute of forms is removed in favour of id.

Related

I Would Like To Use Bootstrap 2 in my Action Mailer View

I currently use Bootstrap 2 in my Rails 4.0.13 application. I am using a table to simulate two columns with the width parameter.
<table style="width: 800px;">
<tr>
<td style="width: 33%; padding: 10px;" valign="top" align="justify"><%= #mass_email_parm["email"].html_email_left.html_safe %></td>
<td style="width: 67%; padding: 10px;" valign="top" align="justify"><%= #mass_email_parm["email"].html_email_text.html_safe %></td>
</tr>
</table>
I have this in my tag in my mailer view.
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
I would like to rewrite my logic using span4 and span8 or something like that if possible. I have tried several times to see if there is a way to use Bootstrap in the mailer but have not found anything.
I thought I might try something like adding the link statement below. However I wonder about the meta statement I have. I have not worked with either of these much regarding mailer views.
<link href="assets/bootstrap_and_overrides.css.less" rel="stylesheet" media="screen">
Unfortunately, many (probably most) email providers strip out external stylesheet links. Gmail and others even strip embedded CSS, meaning your only real option is inline styling. My advice is to either inline style, or use a tool that will convert CSS to inline styles. See this excellent article for more details.

QWebView find text inside invisible elements

In my Qt project I'm using the QWebView to load my html table data.
I'm using the findText function to find text in the html page.
But, I can't find invisible text...
HTML sample :
<table>
<tr>
<td> hello </td>
</tr>
<!-- invisible data -->
<tr style="display:none">
<!-- I want to find this value -->
<td> hey </td>
</tr>
</table>
Is there a way to find invisible text elements via Qt?
I know that I can evaluate JavaScript function for that..
But still I'm looking for some Qt solution?
Thanks in advance.
You can use QWebFrame::findAllElements() function which will perform elements look up by CSS selector and return all found elements as QWebElementCollection regardless of their visibility. From that list you can find the QWebElement that correspond to your searching criterion.

Why did my label not display below a select widget

I think this maybe a stupid question but I really could not figure out what is wrong with what I am doing
<!DOCTYPE html>
<html>
<body>
<table border="1" height = "300px">
<tr>
<td>Cell A</td>
<td>Cell B</td>
<td>
<div id="myCellContainer">
<select id="mySelect"/>
<label id="myMessage">My label</label>
</div>
</td>
</tr>
</table>
</body>
</html>
When this is rendered I was expecting my label to show up below the select box but it did not. Any help is appreciated.
Thank you
Try using:
<select id="mySelect"></select>
This method won't be a self-closing tag.
You need to close your html correctly. Also you need to give the label a width of 100%
DEMO http://jsfiddle.net/LstNS/36/
You could css the select to { display: block } or you could put a <br/> after the select. As it sits your select is an inline-block and following markup occupies the same line unless it wraps.
The problem is that the <label> is inside the <select> element. Look at the rendered mark-up. The element is not a valid self-closing, or void, element, as described by the spec.
It should be:
<select></select>
Once you fix this however, you'll still need to apply block level display to put the label on it's own line:
#myMessage {
display:block;
}
But the deeper question here is, why are you using a <table> to layout a <form>? Form elements are not tabular data. The information you enter into the <form> may be tabular, but the <form> itself it is not. Perfectly adequate positioning and styling can be achieved purely with CSS and the appropriate containers.

Which is better Span that runat server or default asp lable?

I have a simple asp.net web page that contain a table with about 5 TR and each row have 2 TD .. in the page load I get user data ( 5 property ) and view them in this page the following are first 2 rows :
<table>
<tr>
<td>
FullName
</td>
<td>
<span id="fullNameSpan" runat="server"></span>
</td>
</tr>
<tr>
<td>
Username
</td>
<td>
<span id="userNameSpan" runat="server"></span>
</td>
</tr>
</table>
I always used <asp:Label to set value by code but i always notice that label converted in runtime to span so i decided to user span by making him runat=server to be accessed by code, so
Which is better to use asp:label or span with runat=server ??
The answer is: Whatever works best for you.
asp controls have a different object model from html controls. There is no databinding for html controls, for instance.
EDIT:
Something to consider is whether or not you need a span element at all. Span is an html element used for inline items, and canoot hold ceratin kinds of other items (such as block items). If your html markup make sense to semantically include a span (such as you want to style the text in a specific way) then use it.
Unless you need to control attributes on the span tag, it would be better to do something like this though:
<span class="foo"><asp:Literal id="litFoo" runat="server" /></span>
You should only make an element runat="server" if you need to specifically modify the tag itself (not necessarily just it's contents). For instance, if you need to hide the span at runtime, then you make the span runat="server" so you can access it's Visible property at runtime. Otherwise, it should be left as standard html.
If all your doing is displaying something then your better off using a literal tag which add's no extra markup. Infact 99% of the time literal should be used over label.
Edit: The performance between label/span would be so tiny, if any difference between them at all, that the only reason you would be worrying about that sort of performance was if you were facebook.

two infragistics controls on same line

My ASPX code is:
<span>
<igsch:WebDateChooser ID="ContractPeriod2Start" runat="server"
NullDateLabel="" Editable="True" EnableAppStyling="True">
</igsch:WebDateChooser>
<igsch:WebDateChooser ID="ContractPeriod2End" runat="server"
NullDateLabel="" Editable="True" EnableAppStyling="True">
</igsch:WebDateChooser>
<span>Remove</span>
</span>
I want it to render that top-level span all in the same line/row. However infragistics renders that out into a bunch of tables and divs, some greyed out in firebug
<span>
<input ... />
<input ... />
<table ... >...</table>
<div>...</div>
<input ... />
<input ... />
<table ... ></table>
<div ... ></div>
<span>Remove</span>
</span>
which renders out into 3 lines (one for each of two IG controls, one for my Remove span)
How do I make all this generated HTML into the same line?
Assuming the third party control has no way to control the output, the quickest idea I can come up with is to wrap everything in a table. You still would not be controlling the output of each individual control, but you would force the three elements into one line.
So, not pretty, but:
<table>
<tr>
<td><!-- First igsch control here --></td>
<td><!-- Second igsch control here --></td>
<td><span>Remove</span></td>
</tr>
</table>
There is probably some way to write an adapter to generate different html, such as the CSS Friendly Control Adapters, but that would take a much greater effort.

Resources