Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 28th, 2004, 10:32 PM
Authorized User
 
Join Date: Jan 2004
Location: , , .
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default form submit problem

hi all

i have a form with a few fields for user to enter, there's also a button which when clicked, a new textarea that has a html editor attached to it created, if the button is clicked again, the textarea will be removed.

the only problem is if i press the button 2 times, i.e. create the textarea then remove it again, when i try to submit my form, an error msg will popup informing me that something is null.

i know that e error is refering to my external javascript which creates the html editor, how do i solve this?

instead of pasting the code here, i pasted my code into notepad
http://www.geocities.com/dhaywirex/add.txt --my form's code
http://www.geocities.com/dhaywirex/editor.js --the html editor code
http://www.geocities.com/dhaywirex/editor.txt --if the one above cant work
Reply With Quote
  #2 (permalink)  
Old March 29th, 2004, 04:43 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I took a look but it's a lot of code, what exactly is null?

--

Joe
Reply With Quote
  #3 (permalink)  
Old March 29th, 2004, 05:27 AM
Authorized User
 
Join Date: Jan 2004
Location: , , .
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok..heres the short stuff, when the button is clicked, it will call a function in editor.js, supply it with the name of the textarea created with panels.innerHTML = "<textarea name='panel' cols='50' rows='5' id='panel'></textarea>", and the function will create the html editor.
if i submit the form now, no problem
if i close the textarea, i.e. panels.innerHTML = "", the error, document.all[...].config is null or not an object will appear

the exact function called when button is clicked
function createForm() {
if (panelflag == false) {
  data = "<textarea name='panel' cols='50' rows='5' id='panel'></textarea>"
  document.form1.btn.value = "Remove Panels";
  panelflag = true;
}
else {
  data = "";
  document.form1.btn.value = "Add Panels";
  panelflag = false;
}

if (document.layers) {
  document.layers.panels.document.write(data);
  document.layers.panels.document.close();
}
else {
  if (document.all) {
    panels.innerHTML = data;
  }
}

if (panelflag == true) {editor_generate('panel');} 'from editor.js
}


the relevant function in editor.js where the error occured
function editor_generate(objname,userConfig) {
  // Default Settings
  var config = new editor_defaultConfig(objname);
  if (userConfig) {
    for (var thisName in userConfig) {
      if (userConfig[thisName]) { config[thisName] = userConfig[thisName]; }
    }
  }
  document.all[objname].config = config; 'i believe this is where error occured // store config settings
blah blah blah...lots more codes

hope this makes its easier to find out whats wrong
1 more thing, if i actually 'close' my textarea 3 times, the error will appear 3 times, close the textarea 2 times, and the error will pop up 2 times.....

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WebRequest/WebResponse form submit problem. HELP! MAtkins ASP.NET 1.0 and 1.1 Professional 2 December 23rd, 2010 12:28 AM
form submit problem alexscan Beginning PHP 0 January 1st, 2008 08:37 PM
form submit problem/dependent list menus alexscan Pro PHP 0 January 1st, 2008 06:29 PM
Form Submit Problem. muklee Javascript 7 May 27th, 2007 10:06 PM
Firefox Problem - submit form mattastic Javascript How-To 4 July 19th, 2005 07:30 AM



All times are GMT -4. The time now is 10:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.