![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| HTML HTML problems, maybe you are trying to code for MySpace. Get all the HTML coding help here for your website. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I have a case where user can enter some HTML code which is then stored in the database. When I render the page with user's HTML any mistakes made by the user might effect the layout of my page. For example, if the user started a <table> tag, but did not finish it with a </table> tag. This definitely breaks my own layout. What I want to do, is somehow render's user's HTML (not in a popup) without effecting my own html. I want to "SCOPE" user's html to a particular area on the page. Is there a way to do this with Java or JavaScript? Thanks. -AP_ | |||
| Advertisements |
| | #2 | ||
| Just a quick thought .... When your user submits the HTML why not display it in a popup window and ask them if they are sure this is correct ? If so then squirel it away in your DB and display as intended next time. Not sure how to do this in JS but could you search for open tags ( <?? ) and then once found get the closing ones - messy but it would catch any problems. HTH Chris | |||
| | #3 | ||
| Alex Paransky <apara@standardset.com> writes: > I have a case where user can enter some HTML code which is then stored > in the database. When I render the page with user's HTML any mistakes > made by the user might effect the layout of my page. For example, if > the user started a <table> tag, but did not finish it with a </table> > tag. This definitely breaks my own layout. > > What I want to do, is somehow render's user's HTML (not in a popup) > without effecting my own html. I want to "SCOPE" user's html to a > particular area on the page. > > Is there a way to do this with Java or JavaScript? You could use IFRAME or OBJECT to keep the HTML in one place, though there's accessibility and usability problems with that, and it may not look much like you want either. Perhaps a better solution would be to pass the HTML code through HTML Tidy server-side, and then insert that into the database. Valid code will be fine, invalid code will be fixed, though perhaps not in the way that was intended. The suggestion made elsewhere of displaying a preview is probably a good idea - preview post-tidy so they can fix errors caused by tidy making the wrong guess about where to close the tags. -- Chris | |||
| | #4 | ||
| Alex Paransky wrote: > I have a case where user can enter some HTML code which is then stored > in the database. When I render the page with user's HTML any mistakes > made by the user might effect the layout of my page. For example, if > the user started a <table> tag, but did not finish it with a </table> > tag. This definitely breaks my own layout. This can be broken down in to two issues, and should be handled on the server by whatever process is putting the HTML in the database. (1) Ensuring that user-entered HTML is valid and well formed This is probably best done by running submitted data through a validator and if any problems are found displaying an error message to them and asking for it to be edited. (2) Ensuring that the user can't muck anything up This is usually best done with a whitelist of tags and attributes. Any HTML used that isn't in the list gets either silently striped to returned to the user with an error. The whitelist would probably include tags such as <p>, but not <script> and attributes such as lang, but not style. An other option is to ban HTML entirely and use something like textile: http://textism.com/tools/textile/ -- David Dorward http://david.us-lot.org/ Redesign in progress: http://stone.thecoreworlds.net/ Microsoft announces IE is dead (so upgrade): http://minutillo.com/steve/weblog/20...ces-ie-is-dead | |||
| | #5 | ||
| David Dorward <dorward@yahoo.com> wrote in message news:<1057239408.538553@news>... > An other option is to ban HTML entirely and use something like textile: > http://textism.com/tools/textile/ Or any of a number of wiki syntax offerings, like the one described at http://allmyfaqs.com/faq.pl?Intro_and_Tour or http://hytext.com/ww/cgi-bin/ww.pl?Quick_Start ---- jerry (WikiWriter lives at http://hytext.com/ww/ ) | |||
| Featured Websites | ||||
|
![]() |
| Tags: entered, html, messing, own, page, render, user, without |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| page with no .html | olwen | HTML | 6 | 07-01-2007 1:57 PM |
| xbox 360 messing about | Teranews | Console Subjects | 2 | 06-11-2007 10:31 AM |
| User pages - Can HTML Be Used | $atom | New User Help | 2 | 04-18-2007 11:19 AM |
| Query and List, PhP Main Page Auto Listing of User Actio | MakeS | PHP | 1 | 08-30-2006 4:27 PM |
| User page | JeJe | Community Chat | 0 | 07-05-2006 9:06 PM |
| Featured Websites | ||||
|