Bug 22526: Correct bug where form was submitted by pressing enter in last text input if odd number of inputs r=harishd

This commit is contained in:
pollmann%netscape.com 2000-01-11 07:55:54 +00:00
Родитель fd76569535
Коммит 915ecbc26a
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -147,6 +147,7 @@ nsFormFrame::nsFormFrame()
: nsBlockFrame() : nsBlockFrame()
{ {
mTextSubmitter = nsnull; mTextSubmitter = nsnull;
mTextSubmitterSet = PR_FALSE;
} }
nsFormFrame::~nsFormFrame() nsFormFrame::~nsFormFrame()
@ -363,9 +364,12 @@ void nsFormFrame::AddFormControlFrame(nsIPresContext* aPresContext, nsIFormContr
aFrame.GetType(&type); aFrame.GetType(&type);
// a solo text control can be a submitter (if return is hit) // a solo text control can be a submitter (if return is hit)
// XXX pollmann this logic is flawed - three text boxes?
if ((NS_FORM_INPUT_TEXT == type) || (NS_FORM_INPUT_PASSWORD == type)) { if ((NS_FORM_INPUT_TEXT == type) || (NS_FORM_INPUT_PASSWORD == type)) {
mTextSubmitter = (nsnull == mTextSubmitter) ? &aFrame : nsnull; // Only set if this is the first text input found. Otherwise, set to null.
if (!mTextSubmitterSet) {
mTextSubmitter = &aFrame;
mTextSubmitterSet = PR_TRUE;
} else mTextSubmitter = nsnull;
return; return;
} }

Просмотреть файл

@ -109,6 +109,7 @@ protected:
nsVoidArray mFormControls; nsVoidArray mFormControls;
nsVoidArray mRadioGroups; nsVoidArray mRadioGroups;
nsIFormControlFrame* mTextSubmitter; nsIFormControlFrame* mTextSubmitter;
PRBool mTextSubmitterSet;
}; };
#endif // nsFormFrame_h___ #endif // nsFormFrame_h___