Re: no,no,no,Re: [PHP] HTML_AJAX and formSubmit method - Yes ! But why ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Georgi Ivanov wrote:
I didn't  understood what are you saying at first.

I don't control the JS code . It is generated from the HTML_AJAX code.

The problem was fixed when calling formSubmit method like this :
HTML_AJAX.formSubmit(this,target) // No quotes here; target is just a string !

instead of :

HTML_AJAX.formSubmit(this,'target') // This was in the example i've used for testing

So i didn't changed the HTML_AJAX code. Just the client code.
Now the problem is fixed but i still don't understand why ...

maybe you're misunderstanding strings and variables
(and the difference between the 2) in javascript (forgive me if I am wrong
on this).

Either way you have hacked round a what seems to be bug in HTML_AJAX:

if (typeof target == 'string') {
	target = document.getElementById('target');
}

in the above target is a variable - which if of type string
is fed to the document.getElementById() method - only the variable
is not passed but instead a string literal is passed (which
happens to contain the name of the variable that should have been passed)


On Wednesday April 5 2006 16:05, Georgi Ivanov wrote:

does the following make it work? ...

Yes it did ! But why ?
I'm passing string ... not variable...
I don't understand ....


Georgi Ivanov wrote:

...


formSubmit: function (form, target, customRequest)
   {
       if (typeof form == 'string') {
           form = document.getElementById(form);
           if (!form) {
               // let the submit be processed normally
               return false;
           }
       }
       if (typeof target == 'string') {
		//I think we MUST go here but it seems we don't...
           target = document.getElementById('target');

target = document.getElementById(target);

		//               ^-- no quotes!


       }
       if (!target) {
	//I guess we enter here but we shouldn't.....
           target = form;
       }
..........................
The script seems to be OK but...
So generally this script works ONLY if the DIV is with ID=target and
function called like this : HTML_AJAX.formSubmit(this,'target')
If i change the div with ID=alabala and call the script with :
HTML_AJAX.formSubmit(this,'alabala') it does not work.
Any ideas ?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux