From f8bbc3023a3c781011faad37e4d5bbee13523d1b Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Mon, 28 Dec 1998 21:28:53 +0000 Subject: [PATCH] Fire the OnSubmit event on the form not the input field... git-svn-id: svn://10.0.0.236/trunk@16911 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsTextControlFrame.cpp | 17 ++++++++++++----- .../html/forms/src/nsTextControlFrame.cpp | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index dacc8211608..4d5e6b3c116 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -208,11 +208,18 @@ void nsTextControlFrame::EnterPressed(nsIPresContext& aPresContext) { if (mFormFrame && mFormFrame->CanSubmit(*this)) { - nsEventStatus mStatus = nsEventStatus_eIgnore; - nsEvent event; - event.eventStructType = NS_EVENT; - event.message = NS_FORM_SUBMIT; - mContent->HandleDOMEvent(aPresContext, &event, nsnull, DOM_EVENT_INIT, mStatus); + nsIContent *formContent = nsnull; + + mFormFrame->GetContent(formContent); + if (nsnull != formContent) { + nsEvent event; + nsEventStatus status = nsEventStatus_eIgnore; + + event.eventStructType = NS_EVENT; + event.message = NS_FORM_SUBMIT; + formContent->HandleDOMEvent(aPresContext, &event, nsnull, DOM_EVENT_INIT, status); + NS_RELEASE(formContent); + } mFormFrame->OnSubmit(&aPresContext, this); } diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index dacc8211608..4d5e6b3c116 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -208,11 +208,18 @@ void nsTextControlFrame::EnterPressed(nsIPresContext& aPresContext) { if (mFormFrame && mFormFrame->CanSubmit(*this)) { - nsEventStatus mStatus = nsEventStatus_eIgnore; - nsEvent event; - event.eventStructType = NS_EVENT; - event.message = NS_FORM_SUBMIT; - mContent->HandleDOMEvent(aPresContext, &event, nsnull, DOM_EVENT_INIT, mStatus); + nsIContent *formContent = nsnull; + + mFormFrame->GetContent(formContent); + if (nsnull != formContent) { + nsEvent event; + nsEventStatus status = nsEventStatus_eIgnore; + + event.eventStructType = NS_EVENT; + event.message = NS_FORM_SUBMIT; + formContent->HandleDOMEvent(aPresContext, &event, nsnull, DOM_EVENT_INIT, status); + NS_RELEASE(formContent); + } mFormFrame->OnSubmit(&aPresContext, this); }