aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes problem setting form Action name Dynamically on button click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "problem setting form Action name Dynamically on button click" Watch "problem setting form Action name Dynamically on button click" New topic
Author

problem setting form Action name Dynamically on button click

Hemant Thard
Ranch Hand

Joined: Dec 23, 2008
Posts: 122
Hi Guys,

I have an application where i have to change the form action dynamically(using JS) on click of submit button(type=submit).
i have written a simple code to do so.


this works fine with Firefox 3.6 , but with IE 8, i am getting error and am not able to proceed further.

Ieven tried using Jquery, but the result is same.


Can someone help me to figure out what is wrong with the above code.

Regards,
Hemant


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18643
    
    8

That's not JSP, that's Javascript. We have a forum for that. Moving...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

If you use tools improperly, of course things do not work.



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
get() returns the DOM element, you are treating it as a jQuery object.

You want to use eq()

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Of course, the preferred solution would be to give the form an id and use it to directly find the element.
Hemant Thard
Ranch Hand

Joined: Dec 23, 2008
Posts: 122
Hi All,

Thanks for the reply.

I tried everything
Here's my form


but this doesn't seems to work. All i got is Object doesn't support this property.

then i did some googling and i found this.

this article says some element properties has been removed from IE 7-8(including one i am looking for ).

but date of this article concerns me. its dated back to Nov 05 2010. I thing IE might has resolved this problem till now.

can anyone please confirm me or what alternate solution do i have.


Regards,
Hemant
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

That article has nothing to do with anything unless you are using TinyMCE.

Which statement and which property is causing the issue.
Hemant Thard
Ranch Hand

Joined: Dec 23, 2008
Posts: 122
hi Bear,

thanks for reply.

This statement which gives me object doesn't support this property.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

If you are using jQuery, why aren't you using jQuery to do this?
Hemant Thard
Ranch Hand

Joined: Dec 23, 2008
Posts: 122
i tried using that but with no success ..

i tried all the way i mentioned on my previous message.

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Are you getting errors in the console?

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Pick one way, and create an SSCCE that shows the issue. Does this happen on all browsers, or just one?
Hemant Thard
Ranch Hand

Joined: Dec 23, 2008
Posts: 122

Sorry for late reply.

Yes Bear, it happens for IE8. it works fine for Mozilla 3.6.

Yes, i created a small SSCCE and it worked fine in IE 8.(thanks for suggesting me that) .

but still i don't understand what the problem might be.
Its an existing application on which i am doing some modification.

i tried all known way


and still i am getting error "object does not support this property".


since this was some urgent deployment time issue, i had to look some alternate way.

but i still wonder what the problem might be. Is it because of CSS or something else.


any suggestion .. ?


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

You are still doing it two ways. Pick one. One. Just one. Only one.

And, the forms[0] approach when out of vogue in 1998, so guess which one you should concentrate on?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem setting form Action name Dynamically on button click