Textbox displayed instead of checkbox - html

I have very unusual problem. I've created an HTML form with all types of inputs.
Then I put it on a server and what happened took me to the ground literally. All my checkboxes turned into textboxes. The code I put on my website has checkboxes in it, but when I use firebug it says it has textboxes there.
-HTML code is valid:
<input name="ksh" type="checkbox" id="ksh" />
I tried on a different server, it works fine there, so I assume it's a server-based problem. But I have no idea what can cause that. Any ideas?
I'd be thankful for any tips.
Thanks in advance
EDIT
Because I forgot and this may be an important factor I also paste doctype declaration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
EDIT 2
http://larte2002.vizz.pl/gosc/bl/cennik/ <- client's server, which shows textboxes
http://89.65.65.3/BL/cennik/ <- my server, checkboxes
Content on servers is exactly the same on both!

According to this, for checkboxes the format is input type="checkbox" name="boxname" value="boxval">Box text , so it may be that you have the name before type instead of after. Maybe try switching that.

Related

Encoding issue in Mailchimp emails

I created a Mailchimp template for the email newsletter of the company I work for. There's an issue with some links and I can't work out how to fix them.
I add a link into the email like so:
Contact Us
And the link appears fine, but when clicked within Gmail it takes you to the site's 404 page, even though the URL is (on the surface) correct.
After clicking the link, the URL displayed in the address bar is http://www.nameofcompany.com/contact-us.php, which is the correct URL and which when typed into the address bar directly goes to the correct page. But when I visit this URL from the email, then copy and paste it from the address bar into a new email in Gmail, I see: http://www.nameofcompany.com/contact%E2%80%90us.php
So this appears to be an issue with character encoding. I have no idea how to fix it though.
Here's the doctype, charset etc from the HTML of the email.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
The strangest thing is, most URLs in the email work perfectly fine, even those with dashes in.
What's causing this issue and how can I fix it?
Cheers
Okay, fixed it. I found the template on Mailchimp and used "Edit this template's code" to edit the HTML within my browser. Then I found the tag that was causing the trouble, deleted it and typed it back out again. Bit of a crude fix and I'm not sure why the problem originally arose but it's done the job!
E2 80 90 is the Unicode byte sequence for the multibyte hyphen character and you should be using the ASCII one.
Which app. do you use for coding your html files? This has to do with the encoding of the hyphen. Try using a simple text font if you are given such option at your code editor (such as Courier).
I don't know why hyphen was encoded into 3 bytes here - usually non alpha/num characters in URL are encoded into one byte.
Try replacing hyphen with %2D, so that hyphen won't be transformed into %E2%80%90.

Modyfing code completion in PhpStorm 5

After entering first characters of <textarea> tag and using autocomplete ( e.g. <texta and hitting ENTER) editor generates following snippet: <textarea rows="" cols=""
It's extremely unhelpful since I don't use rows and cols attributes.
How can I modify those snippets ?
I tried "Live templates" section but it's not there.
In this case code completion is performed according to the DTD, which defines rows and cols attributes of the textarea tag as Required.
Most likely your file starts with:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
or the default HTML language level defines it.
To address this problem you can create HTML 5 files with <!DOCTYPE html> and PhpStorm will stop completing these attributes.
See also the related IDE setting:

HTML <!doctype html public "">

One of the new doctype declarations can be specified as:
<!doctype html>
But recently I came across one which was slightly different (view source on http://html5boilerplate.com/):
<!doctype html public "">
But I couldn't figure what is it for, public part?
Thanks.
You missed one important character
<!doctype html public "✰">
Inside the quotes is a star character. They like putting it everywhere. Its valid but not in any way useful :P
this is mentioned in the html5boilerplate changelog, do a search for doctype on the page.
Its been done to disable dtd warnings in IDE's like eclipse.
See: Disable DTD warning for Ant scripts in Eclipse?
IE10 needs the PUBLIC "" to properly treat the page as HTML 5 - at least on the Windows 7 version.

autocomplete attribute is not passing XHTML 1.0 Transitional validation, why?

I'm trying to cleanup my xhtml validation -- I'm running my pages through the W3C validator. For some puzzling reason it's not passing on input fields with the autocomplete="off" attribute:
<input name="kwsearch" id="sli_search_1" type="text" autocomplete="off" onfocus="if(this.defaultValue==this.value) this.value='';"
onblur="if(this.value=='')this.value=this.defaultValue;" class="searchbox" value="Search" />
I'm using this doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
And this is the validation error:
Line 410, Column 81: there is no attribute "autocomplete"
…li_search_1" type="text" autocomplete="off" onfocus="if(this.defaultValue==thi…
I thought this was okay with the W3C -- but, maybe it's still in "submission" phase?
http://www.w3.org/Submission/web-forms2/#autocomplete
Thoughts?
The Web forms specification has nothing to do with HTML 4 / XHTML. Sadly, autocomplete will not pass validation.
I think the only way to achieve valid HTML 4 /XHTML with autocomplete turned off is adding the attribute on page load using JavaScript. Sucks, I know - but I think it's the only way.
autocomplete is a HTML5 attribute, so use a HTML5 document type declaration, if you need it.
That W3C link is for the web forms stuff, not core XHTML. It might be possible to pull in the extra DTD for the web forms and get the page to validate.
If you need autocomplete( browsers do support it ), then try extending your doctype, like in this XHTML 1.1 below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
<!ATTLIST form autocomplete (on|off) #IMPLIED>
]>
I've just banged up against this irritating conflict between browsers and standards. I ended up getting around it by running javascript ON THE PAGE, not waiting for window.onLoad or $(document).ready(), to add the attribute to all elements with the class no-browser-autocomplete. Then i went through my app removing autocomplete="off" and adding this class instead.
Obviously this will fail in browser environments not running javascript.
The reason that i do it on the page, rather than in a dom ready block, is that if you wait for dom ready, the browser's already autocompleted it, at least in Firefox (which i'm testing it in).
So, this is at the start of one of the javascript files i include in my app layout:
//this needs to run BEFORE all of the loaded/ready events fire, that's why it's not in the dom.ready function
$(".no-browser-autocomplete").attr("autocomplete", "off");
$(function(){
//dom ready
});

strange markup in HTML (HTML_ATR HTML_ELM, SYN_ROW, JS_KEY, etc..)

I've build a website for a client and as we all know 'it works just fine on my machine' :-) as it does on several machines at my clients location. But they have (so far) 3 pc's on wich some errors occur, like cannot find ElementById. These machines are normal up-to-date windows machines running IE8.
When comparing the html-source of the page on my machine with one of a machine on wich the error occurred I found that there seems to be a s--tload of html injected. Loads of DIVS and SPAN around attributes and elementID's and even javascript :
Normal:
<script type="text/javascript" language="JavaScript">
After injection:
script will be surrounded with a SPAN tag using class 'HTML_ELM'
type will be surrounded with a SPAN tag using class 'HTML_ATR'
"text/javascript" will be surrounded with a SPAN tag using class 'HTML_VAL'
<<span class="HTML_ELM">script</span> <span class="HTML_ATR">type</span>=<span class="HTML_VAL">"text/javascript"</span> <span class="HTML_ATR">language</span>=<span class="HTML_VAL">"JavaScript"</span>>
even ID's of html elements are surrounded with these SPAN tags (class='JS_STR') probably causing the problem of cannot find ElementById
I have no idea why this is happening, I also cannot find a cause on Google when searching for these weird classnames used by the injected SPAN/HTML tags (HTML_VAL, HTML_ELM, HTML_VAL).
Does anyone here know what could be causing this ?
many thanks,
Jurjen.
Well, since you are running IE8, are some of the machines in compatibility mode?
This extra code comes from the IE8 source viewer. In IE8, if you view source and go to the File menu there are two options under Save, HTML Source and Formatted HTML View. The Formatted HTML View contains all the extra code you are seeing.
Do your HTML files start with a valid DTD ?
like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Try running it through html-tidy.
An online tidier can be found at http://infohound.net/tidy/.
Then, it'll be easier to track down the problem. It sounds like malformed html.
Googling span class=HTML_ELM returns lots of results but they've got nothing much in common.
You don't have a syntax highlighter script (or something similar) running on the site by any chance?