By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,793 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,793 IT Pros & Developers. It's quick & easy.

Programmatic onsubmit in IE

P: 1
Hi,

I have a form, which is sometimes submitted by clicking a submit button, sometimes by enter being pressed in a field, and sometimes programmatically (By the clicking of a "Master Save" elsewhere on the page).

So I created an onsubmit event to do field validation. This works for the first two methods, but breaks for the third. (Ridiculously, the submit() function doesn't trigger onsubmit!)

To hack my way around that, I call the onsubmit event programatically too, but as the form is in an IFrame and the "Master Save" is in the parent page, I can't call the javascript function by name, and have to do this:

if (document.getElementById('IFrame1').contentDocumen t.forms[0].onsubmit())
document.getElementById('IFrame1').contentDocument .forms[0].submit();

This works fine in FF, but IE6 is giving me issues. I know, IE6 is ancient, I have no choice, that's the browser the company mandates.

Can anyone suggest why this is breaking, or how else I can call the function in the IFrame?

Thanks,
Rich
Oct 16 '08 #1
Share this Question
Share on Google+
1 Reply


P: 93
Theh better way of acessing the element under the iframe tag is like
Expand|Select|Wrap|Line Numbers
  1. window.frames[0].document.getElementById('daLink').style.backgroundColor='#00000F'
where frames[0] says that it is the first Iframe of the page instead of that you can also give the name of the frame like frames['My new Frame']

This will work fine If you still have query please let us know .
Oct 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.