/    Sign up×
Community /Pin to ProfileBookmark

XHTML Strict Validation for custom attributes

Hi I am wondering if anyone knows how I can get my custom attributes to validate in XHTML Strict? I have to have it validate as it is for a class

Example of the form:

[code=html]input onkeyup=”TF_filterTable(document.getElementById(‘dataTable’), filter)” size=”40″ tf_colkey=”name”tf_searchtype=”substring” />[/code]

Example of the JS:

[CODE]var inputs = frm.getElementsByTagName(“INPUT”);
for (var i=0;i<inputs.length;i++)
{ //looping thru all INPUT elements
if (inputs[i].getAttribute(“TF_colKey”) == null) //attribute not found
continue; //we assume that this input field is not for us
switch (inputs[i].type)
{
case “text”:
case “hidden”:
if(inputs[i].value != “”)
{
index = conditions.length;
conditions[index] = new Object;
conditions[index].name = inputs[i].getAttribute(“TF_colKey”);
conditions[index].type = inputs[i].getAttribute(“TF_searchType”);
conditions[index].value = inputs[i].value;
conditions[index].single = true;
}
break[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@3NexMay 01.2010 — I'm pretty sure you cannot do that. I mean if an attribute doesn't exist, then it doesn't exist.

Personally, I would use some other valid attributes to do this job that they weren't intended for. For example, you need two custom attributes, so instead of calling them tf_colkey and tf_searchtype, I would call them title and class, then change the javascript code accordingly. So, you do your own judgement if that's an okay idea or not.
Copy linkTweet thisAlerts:
@KattysauthorMay 02.2010 — That worked awesome! thank you!
×

Success!

Help @Kattys spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...