Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-03-24 18:33:16

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

problem with javascript submit

When I try to save form by javascript, I lose my data:( I think I must save the iframe content to the textarea, but I don't now - how?:(

Last edited by glebushka (2005-03-24 18:33:35)

Offline

#2 2005-03-25 03:07:05

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: problem with javascript submit

you must first call
form.onsubmit();
then
form.submit();

...we should open a FAQ-wiki page!!


Niko

Offline

#3 2005-03-25 04:28:09

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

Re: problem with javascript submit

Yes. I have read this solution, I write in my source:
document.edit.onsubmit();
document.edit.submit();
In JavaScript console I receive error:
Error: document.edit.onsubmit is not a function
I use FF 1.0.x

Offline

#4 2005-03-25 06:00:53

mmcw
New member
Registered: 2005-02-19
Posts: 4

Re: problem with javascript submit

NOT

document.edit.onsubmit();
document.edit.submit();

But

form.onsubmit();
form.submit();

Offline

#5 2005-03-25 06:54:03

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

Re: problem with javascript submit

mmcw wrote:

form.onsubmit();

Error: form is not defined

I have following form tag:
<form action="http://my_url" method="post" enctype="multipart/form-data" id="edit" name="edit">
Hm... I try to submit with submit-button, but it dosn't work anyway...What may caused this problem? Any ideas?
I have other javascripts on the page. I'll try to remove them.

Offline

#6 2005-03-25 21:10:49

mroch
New member
Registered: 2005-03-25
Posts: 1

Re: problem with javascript submit

glebushka wrote:
mmcw wrote:

form.onsubmit();

Error: form is not defined

I have following form tag:
<form action="http://my_url" method="post" enctype="multipart/form-data" id="edit" name="edit">
Hm... I try to submit with submit-button, but it dosn't work anyway...What may caused this problem? Any ideas?
I have other javascripts on the page. I'll try to remove them.

Try

var form = document.getElementById("edit");
form.onsubmit();
form.submit();

You can simplify the code required in an onclick with:

function customSubmit(formname) {
   var form = document.getElementById(formname);
   form.onsubmit(); form.submit();
}

Offline

#7 2005-03-26 12:55:23

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

Re: problem with javascript submit

I don't understand. Why doesn't work http://abik.ru/cgi-bin/try.pl ?
This test form process perl script. Received values "content" and "content1" insert in corresponding textareas.
Second textarea (without Xinha) work. But first doesn't. Why?

Offline

#8 2005-03-26 13:18:42

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: problem with javascript submit

try to add this

      HTMLArea._addEvent(html_editor._htmlArea, "mouseout", function () {
          html_editor._textArea.value = html_editor.getHTML();
      });

or put such code when you want

Offline

#9 2005-03-26 13:18:58

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: problem with javascript submit

try to add this

      HTMLArea._addEvent(html_editor._htmlArea, "mouseout", function () {
          html_editor._textArea.value = html_editor.getHTML();
      });

or put such code when you want

Offline

#10 2005-03-26 13:49:13

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

Re: problem with javascript submit

As I see html_editor in my case is xinha_editors['content']. I insert your strings after HTMLArea.startEditors(xinha_editors);
But it doesn't work anyway (see  http://abik.ru/cgi-bin/try.pl)
Can anyone show me realy working form with Xinha (with FF1.0.x)?

Offline

#11 2005-03-26 14:28:24

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: problem with javascript submit

I use it everyday in a form with that function...
html_editor is the HTMLArea created... so that is what you have done but the editor is not created so the problem comme from that gecko editor needs EnterParagraph plugin which is not declared (this is for me a stupid thing...)

try to declare it

Offline

#12 2005-03-26 14:28:30

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: problem with javascript submit

I use it everyday in a form with that function...
html_editor is the HTMLArea created... so that is what you have done but the editor is not created so the problem comme from that gecko editor needs EnterParagraph plugin which is not declared (this is for me a stupid thing...)

try to declare it

Offline

#13 2005-03-26 15:10:18

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

Re: problem with javascript submit

guillaumed, I declared EnterParagraphs plugin. But it doesn't work:( Can you show me your working code (if it is possible, whole page)? Post there or on my e-mail - gleb at stalnoy.ru. Thx.

Offline

#14 2005-03-26 17:27:49

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: problem with javascript submit

Give me your email cause I cannot send you one thru this forum (I don't know why...)

Offline

#15 2005-03-26 17:42:56

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

Re: problem with javascript submit

Thanks! My e-mail: gleb@stalnoy.ru

Offline

#16 2005-03-27 10:17:22

glebushka
Xinha Community Member
From: Moscow
Registered: 2005-02-26
Posts: 11
Website

Re: problem with javascript submit

Thanks for all,  especially for guillaumed. The problem was much more simple that we thought.
If we write in code:
<table>
<form>
It doesn't work.
But if we first write tag <form>, and then <table>. It works perfectly. I think this is a bag.

Offline

Board footer

Powered by FluxBB