Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 18th, 2004, 07:31 PM
SimonGreenhill's Avatar
SimonGreenhill SimonGreenhill is offline
(retired)
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Dec 2003
Location: The Laboratory
Posts: 10,101 SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 4925 Folding Title: Novice Folder
Time spent in forums: 3 Months 3 Weeks 5 h 49 m 4 sec
Reputation Power: 1331
Facebook
How to make an extended character inserter for a form?

Afternoon all,

I've written a web editor system for my database, using php to process form data. However, I need to be able to enter extended unicode characters. At the moment I've got a list of the more commonly used ones in a table, and just cut'n'paste them when I want to enter them into my textbox/input fields.

Problem: this is time consuming.

Question: Any other ways to do this?

I've thought about using, say something like:
1 = 'U+00D5'
2 = 'U+00D6'
etc, and use php/python to translate them later, but with 20+ characters this would quickly get confusing.

My second idea is to use something like the forum smilies thing on my right here. where if I click a smily face it inserts '' (ie ':' + ')' ) into the textbox. How is this done? I'm assuming javascript - but as I don't know javascript (& have tried to avoid it in the past, but I'm willing to bite the bullet and learn some).

Any ideas or suggestions?

Cheers,
Simon

(Posted here because I'm not sure where else to put it.)

Reply With Quote
  #2  
Old July 18th, 2004, 11:30 PM
SimonGreenhill's Avatar
SimonGreenhill SimonGreenhill is offline
(retired)
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Dec 2003
Location: The Laboratory
Posts: 10,101 SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 4925 Folding Title: Novice Folder
Time spent in forums: 3 Months 3 Weeks 5 h 49 m 4 sec
Reputation Power: 1331
Facebook
ok. Looking through various forums and with extensive use of google etc I found this:
http://forums.devshed.com/showthrea...25817&forumid=1

Which I've rewritten to:
PHP Code:
<HTML>
<
HEAD>
<
SCRIPT language=JavaScript>
function 
add_unicode_char(str)
{
    
document.form1.msg.value += str;    
    
// Append the string str to the message text.
    
document.form1.msg.focus();
    
// Send the focus back to the message box.
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="form1">
<TEXTAREA name="msg"></TEXTAREA>
<TEXTAREA name="msg2"></TEXTAREA>
</FORM>

<a href="javascript: add_unicode_char('1');">1</a>
<a href="javascript: add_unicode_char('2');">2</a>
<a href="javascript: add_unicode_char('3');">3</a>
<a href="javascript: add_unicode_char('4');">4</a>
<!-- Note unicode chars. changed to numbers because the forum just removes extended chars. -->
</BODY>
</HTML> 


This works, but will only add the character to the textarea 'msg' & and not 'msg2'. The page will have ~25 input fields, so it needs the character inserted into the correct field. How can I change where the character is inserted?

I'm assuming I'd need to use onFocus() or something here, but I tried setting a variable to store the current_focus (ie: var current_focus = 'msg2') passed this to the add_unicode_char(fieldname, str) function. However, this didn't work, otherwise I'd be relaxing at home right now.

Can anyone with some knowledge of javascript help out here?

Cheers,
Simon

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > How to make an extended character inserter for a form?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway