/    Sign up×
Community /Pin to ProfileBookmark

Detecting if HTML tags have been entered

[FONT=Tahoma]I am trying to find out how you can detect if a user has entered html tags in a form field for instance? On this occassion it will be in an textarea and text input field.

I have some script which already checks for other validation when the user clicks submit but need to add the html tags detection.

Can anyone help?

Thanks
Jon[/FONT]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Mar 21.2006 — Check really needs to be done on the server since it can be bypassed, but you could do basic checks for <.*> or just convert them to their entitlites.

Eric
Copy linkTweet thisAlerts:
@jonwinterauthorMar 22.2006 — Thanks for the tip. Should I post this query on the asp board if that is the case? Not confident enough to code the checks the mention as I'm not that proficient with coding....unfortunately! ?
Copy linkTweet thisAlerts:
@KorMar 22.2006 — You MUST validate for HTML tags at a server-side level. In addition, yes, you may use a client-side javascript regExp validator like this:
<i>
</i>&lt;input type="text" onkeyup="this.value=this.value.replace(/[&lt;-&gt;]/g,'')"&gt;
Copy linkTweet thisAlerts:
@jonwinterauthorMar 22.2006 — Nice piece of script. ?) Can you help as when you type normal text and move the cursor it keeps jumping to the end of the text and won't let you go back to edit it?

Thanks

Jon
×

Success!

Help @jonwinter 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.6,
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,
)...