James Posted December 16, 2002 Posted December 16, 2002 Whenever my form postback from a dropdown control I get a javascript error stating, "Object doesn't support this property or method." I think this happens on theform.submit(); line below. Does anyone know how I can fix this problem? function __doPostBack(eventTarget, eventArgument) { var theform = document.Form1; theform.__EVENTTARGET.value = eventTarget; theform.__EVENTARGUMENT.value = eventArgument; theform.submit(); } Thanks, James Quote
*Gurus* divil Posted December 16, 2002 *Gurus* Posted December 16, 2002 What browser are you using? If your form is indeed called Form1, which I assume it is if the __EVENT things are set property, that line should certainly work. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Moderators Robby Posted December 16, 2002 Moderators Posted December 16, 2002 Why are you using the doPostBack, a control that is Runat Server will Postback on its own. Quote Visit...Bassic Software
Moderators Robby Posted December 16, 2002 Moderators Posted December 16, 2002 Then in the form Load you can check ... if IsPostBack then 'do something end if Quote Visit...Bassic Software
James Posted December 16, 2002 Author Posted December 16, 2002 I have IsPostBack in my code. Also, the reason why I am using doPostBack is because I have a dropdown control that has AutoPostBack="true" and the dropdown calls a VB sub procedure. In order for my dropdown to work I thought I was suppose to add AutoPostBack="true". The AutoPostBack adds a doPostBack function automatically. Any thoughts? James Quote
Moderators Robby Posted December 16, 2002 Moderators Posted December 16, 2002 is the VB sub called before or after Postback? Quote Visit...Bassic Software
James Posted December 16, 2002 Author Posted December 16, 2002 I found my problem. I have a button control with the id="submit". For some reason the postback doesn't like buttons with the id="submit." If anyone know why please let me know. James Quote
*Experts* Bucky Posted December 16, 2002 *Experts* Posted December 16, 2002 Since the button is named submit, calling theform.submit() in the JS you pasted refers to that control instead of the submit method of the form like it is supposed to. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.