Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Format text on a submit form. Bold etc.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedFormat text on a submit form. Bold etc.

 Post Reply Post Reply
Author
sccs View Drop Down
Groupie
Groupie
Avatar

Joined: 31 October 2002
Location: United Kingdom
Status: Offline
Points: 54
Direct Link To This Post Topic: Format text on a submit form. Bold etc.
    Posted: 27 September 2005 at 9:28am
I have created a form for Admin users to add news items to our website. What I would like to do is to let the user change the font, make it bold etc. Just like the one on this form.
How easy is it and how is it done?
Thanks
Andy
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Direct Link To This Post Posted: 27 September 2005 at 8:18pm
find out the tags for what you want to do (eg <b></b> for bold) then set up a button so that it  runs a js function:
 
document.form.field.value = document.form.field.value + '<b>'
 
which will give you the content of the textarea plus the opening bold tag. you'd need to have some way to tell whether the tag is open or not, so you know whether to close or open it. There's probably some nice clean way to do this, but the simplest way i can think of is to have a hidden field (name="boldtag") that your js function sets the value of to either open or close... something like:
 
function boldtags(){
if (document.form.boldtag.value == 'open'){
document.form.boldtag.value = 'closed'
document.form.textarea1.value = document.form.textarea1.value + '</b>'
}else{
document.form.boldtag.value = 'open'
document.form.textarea1.value = document.form.textarea1.value + '<b>'
}}
 
on the downside, you have to have a function for each type of change that you want to make.
 
then there's the fact that that function's only theoretical, and i've never used it... Smile
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.