Disabled submit button in konqueror

Todd Charron tcharron at mnsi.net
Thu Nov 14 17:41:30 GMT 2002


AFAIK disabled buttons shouldn't respond to onclicks etc, but that's
just my best guess.  btw, have i mentioned how much you kick ass? 
Thanks,

Todd

On Thu, 2002-11-14 at 12:38, David Faure wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Thursday 14 November 2002 18:02, Todd Charron wrote:
> > Sure,
> > 
> > http://www.inetontario.com/~tcharron/test2.html
> 
> Ok, this is how the form gets submitted although the button is disabled:
> 2: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM19HTMLFormElementImpl13prepareSubmitEv+0x2c) [0x41c4320c]
> 3: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM20HTMLInputElementImpl8activateEv+0x69) [0x41c47f53]
> 4: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM20HTMLInputElementImpl19defaultEventHandlerEPNS_9EventImplE+0x13a) [0x41c47ece]
> 5: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM8NodeImpl20dispatchGenericEventEPNS_9EventImplERi+0x2f8) [0x41c0cbe0]
> 6: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM8NodeImpl13dispatchEventEPNS_9EventImplERib+0x5a) [0x41c0c84e]
> 7: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM8NodeImpl15dispatchUIEventEii+0xc1) [0x41c0d1eb]
> 8: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM8NodeImpl20dispatchGenericEventEPNS_9EventImplERi+0x34a) [0x41c0cc32]
> 9: /usr/local/kde/lib/libkhtml.so.4(_ZN3DOM8NodeImpl13dispatchEventEPNS_9EventImplERib+0x5a) [0x41c0c84e]
> 10: /usr/local/kde/lib/libkhtml.so.4(_ZN9KHTMLView18dispatchMouseEventEiPN3DOM8NodeImplEbiP11QMouseEventbi+0x69e) [0x41bc4ae0]
> 11: /usr/local/kde/lib/libkhtml.so.4(_ZN9KHTMLView25viewportMouseReleaseEventEP11QMouseEvent+0x1c3) [0x41bc157d]
> 
> Not sure what the DOM says about this: are disabled buttons supposed to get
> mousedown, mouseup and click events?
> Anyway KHTMLView doesn't know it's a button (only a NodeImpl), so the only
> place where this can be fixed easily is in HTMLInputElementImpl.
> Patch attached.
> 
> > no javascript just html.  Clicking it goes to my previous test case (it
> > shouldn't do anything when you click on it).  Btw did anything ever come
> > of my previous one?
> 
> Coincidences are funny - I submitted my patch 5 minutes before you sent this mail :)
> (Dirk finally said that emulating IE wasn't worth the trouble on this one :) )
> 
> This patch also takes care of not trying to use a disabled submit button when
> pressing Return :)
> 
> - -- 
> David FAURE, david at mandrakesoft.com, faure at kde.org
> http://people.mandrakesoft.com/~david/
> Contributing to: http://www.konqueror.org/, http://www.koffice.org/
> Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
> 
> iD8DBQE909+H72KcVAmwbhARAqwaAJoCy9WpKQL0toI0GdNa0EA26g8jOgCggmIv
> Q52cCL5U8Xlrp+OsPIulNbg=
> =QnsQ
> -----END PGP SIGNATURE-----
> ----
> 

> ? htmltokenizer.cpp.debugoutput
> ? patch_frames_coll
> Index: html_formimpl.cpp
> ===================================================================
> RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.cpp,v
> retrieving revision 1.297
> diff -u -p -r1.297 html_formimpl.cpp
> --- html_formimpl.cpp	2002/11/14 16:55:59	1.297
> +++ html_formimpl.cpp	2002/11/14 17:37:55
> @@ -344,13 +344,13 @@ void HTMLFormElementImpl::submitFromKeyb
>      for (QPtrListIterator<HTMLGenericFormElementImpl> it(formElements); it.current(); ++it) {
>          if (it.current()->id() == ID_BUTTON) {
>              HTMLButtonElementImpl* current = static_cast<HTMLButtonElementImpl *>(it.current());
> -            if (current->buttonType() == HTMLButtonElementImpl::SUBMIT) {
> +            if (current->buttonType() == HTMLButtonElementImpl::SUBMIT && !current->disabled()) {
>                  current->activate();
>                  return;
>              }
>          } else if (it.current()->id() == ID_INPUT) {
>              HTMLInputElementImpl* current = static_cast<HTMLInputElementImpl *>(it.current());
> -            if (current->inputType() == HTMLInputElementImpl::SUBMIT) {
> +            if (current->inputType() == HTMLInputElementImpl::SUBMIT && !current->disabled()) {
>                  current->activate();
>                  return;
>              }
> @@ -656,7 +656,7 @@ bool HTMLGenericFormElementImpl::isSelec
>  
>  void HTMLGenericFormElementImpl::defaultEventHandler(EventImpl *evt)
>  {
> -    if (evt->target()==this)
> +    if (evt->target()==this && !m_disabled)
>      {
>          // Report focus in/out changes to the browser extension (editable widgets only)
>          KHTMLView *view = getDocument()->view();
> @@ -782,6 +782,8 @@ void HTMLButtonElementImpl::defaultEvent
>  
>  void HTMLButtonElementImpl::activate()
>  {
> +    if ( m_disabled )
> +        return;
>      m_clicked = true;
>  
>      if(m_form && m_type == SUBMIT) {
> @@ -1361,7 +1363,7 @@ void HTMLInputElementImpl::defaultEventH
>  
>  void HTMLInputElementImpl::activate()
>  {
> -    if (!m_form || !m_render)
> +    if (!m_form || !m_render || m_disabled)
>          return;
>  
>      m_clicked = true;






More information about the kfm-devel mailing list