ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 8th, 2002, 02:03 AM
Rule Rule is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 7 Rule User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
WYSIWYG-editor question - multiple editors

Is it possible to put more
than one editor on a page? I'm not very good at Java, but when I look at the
code, it seems to me that when it is possible to pass the id-value over to
the functions i.e. doBold(), I could put more than one editor on a page
without duplicating the fuctions for each editor. Is this possible and could
you explain how?

Reply With Quote
  #2  
Old July 8th, 2002, 02:58 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 17
Send a message via ICQ to James Yang
Rule

It is possible but it is very time consuming work

for every editor, you need to make most methods and all variables have unique name.

What i recommed is to make the editor dynamically generated using a function which takes in a unique id. That way you don't need to write js and html manually for every editor in the page.

or if you are using it in ASP.NET simply invest in our new EditWorks Professional.NET . Its very cheap and has heaps of features!!!
__________________
Regards,

James Yang
.NET Developer / Network Engineer
MCSE, MCDBA, MCSA, CCNA

http://www.yellowpin.com/
http://www.opentechsupport.com/

Reply With Quote
  #3  
Old July 8th, 2002, 03:56 AM
Rule Rule is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 7 Rule User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
So it's not as simple to pass the id of the iframe along to the functions as a variable and then adjust the functions so that tey use this variable in stead of the fixed iframe id?

Reply With Quote
  #4  
Old July 8th, 2002, 04:01 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 17
Send a message via ICQ to James Yang
Yeah that's okay too. I'll say that's a better way of doing it.

But you need to modify the all the functions though... The support file that comes with the article doesn't use that technique.

Reply With Quote
  #5  
Old July 8th, 2002, 04:02 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 17
Send a message via ICQ to James Yang
You will still need a hidden input for each editor though... if you are to use it at the server side.

Reply With Quote
  #6  
Old July 8th, 2002, 04:18 AM
Rule Rule is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 7 Rule User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My problem is that I don't know how to pass the id to the functions and how to use in in the function.
Could you give me an example?

I've tried the following:

function doBold(var)
{
var.document.execCommand('bold', false, null);
}



...

onClick="doBold('i_View')"

...

iframe id="i_View"


But that didn't work. I don't know java so this was my best shot.

Reply With Quote
  #7  
Old July 8th, 2002, 04:26 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 17
Send a message via ICQ to James Yang
Im not sure ..how this would be done.. U see im not a js guy at all
!!/ but

try using GetElementByID function

GetElementByID(iView).document.execCommand ...

here is a tutorial link

http://getelementbyid.com/tutorials...hod/index.shtml

Reply With Quote
  #8  
Old July 8th, 2002, 04:54 AM
Rule Rule is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 7 Rule User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It seems to me that "document.getElementById" doesn't work with the iframe.



document.getElementById(iview).document.execComman d('bold',false,null);
doesn't work,

document.getElementById(iview).document.style.visi bility = "hidden";
works fine.

Reply With Quote
  #9  
Old July 8th, 2002, 06:40 AM
dgibson dgibson is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Urbana, MD, USA
Posts: 66 dgibson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
You've got the right idea - just pass the field name with each function call. You could probably alias the variable as an object, but I just used eval() to get it running and preserve a similar syntax in the code. For example, I pass in the WYSIWYG name as 'editPane' in the function and then use something like this:

eval(editPane+'.document.execCommand(\'backcolor\' , false, bCol)');

I've never used that getElementById, so don't worry about that either. It really is easier if you're using something like ASP or PHP (I use CF) to auto-generate the editor and form filed names. I also had to change the visibility toggle on the select dropdowns as a result.

Reply With Quote
  #10  
Old July 8th, 2002, 07:12 AM
Rule Rule is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 7 Rule User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I tried your answer but without success. I get an error that the WYSIWYG name doesn't exist on the line where I put the eval... function. So the name gets passed through but I can't use it there. This is the same result as when I don't use the eval function but put myvariable.document. ... to execute the function. So why does that id not exist there?

Reply With Quote
  #11  
Old July 8th, 2002, 07:40 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 17
Send a message via ICQ to James Yang
this is a trick mytch told me and worked most of the time when there was id doesn't exist error.

setTimeout("puturcommandhere",1);

replace puturcommandhere with ur line of code.

i dunno why this works but it works!!

Reply With Quote
  #12  
Old July 8th, 2002, 07:58 AM
Rule Rule is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 7 Rule User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Nope, didn't work, keeps telling me iview is undefined.

I'm just looking for a way to pass the iframe id to the doBold function. If I have that, all problems are solved.

Reply With Quote
  #13  
Old July 8th, 2002, 09:15 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 17
Send a message via ICQ to James Yang
this might sound dumb

but try putting the js after the iframe.. like near the end of the body tag...

probably won't work.. but try..

Reply With Quote
  #14  
Old July 9th, 2002, 06:29 AM
Rule Rule is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 7 Rule User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No changes, still undefined iview

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > WYSIWYG-editor question - multiple editors


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap