Prevent multiple submit buttons from showing "Working..." on submit

502 views
Skip to first unread message

Mark Li

unread,
Dec 4, 2013, 9:02:22 PM12/4/13
to web...@googlegroups.com
I currently have 2 submit buttons in a form. When a user clicks on one of them, it changes both submit input values to "Working..."

I looked into web2py.js and tried applying the suggestion there for preventing "Working.." from showing up on the buttons


/*if you don't want to see "working..." on buttons, replace the following
      * two lines with this one
      * el.data('w2p_disable_with', el[method]());
      */


This would be fine with 1 submit button. However, with 2 submit buttons, the value of the 2nd submit button is changed to the value of the 1st.

For example, button 1 text is "Save", and button 2 text is "Post", clicking on either will change button 2 text to "Save" (after applying the suggestions from web2py.js


Is there any way to disable the changing of the value/text of the submit input on submission (for multiple submit buttons in 1 form)?

Niphlod

unread,
Dec 5, 2013, 3:50:00 PM12/5/13
to web...@googlegroups.com
uhm, you're right. However, usually with different submit buttons you'd likely have one of them having a "name" attribute (and those are "excluded" from being put in the "working..." state).... is this your case ?

How are you handling different "posts" based on the fact that the user clicks on one instead of the other ?

BTW2: if any "clickable-something" has a data-w2p_disable_with attribute, that one is used instead of the default "Working..." message 


Mark Li

unread,
Dec 5, 2013, 6:31:17 PM12/5/13
to web...@googlegroups.com
Hey Niphlod,

The 2 submit buttons have different names, here's the resulting HTML.

<tr id="submit_record__row">
   
<td class="w2p_fl"></td>
   
<td class="w2p_fw">
       
<input name="save_progress" type="submit" value="Save Progress" />
       
<input class="btn" name="post_playlist" type="submit" value="Post Playlist" />
   
</td>
   
<td class="w2p_fc"></td>
</tr>

However, clicking on either results in both having the "working..." message. Is this not intended behavior?

One of the form submit buttons is from the SQLFORM (i add a _name attribute later), and the other one I insert into the form.

Niphlod

unread,
Dec 6, 2013, 2:55:21 PM12/6/13
to web...@googlegroups.com
can you please check that your web2py.js is the same one shipped with the latest web2py ?
You can fetch it here
https://raw.github.com/web2py/web2py/master/applications/welcome/static/js/web2py.js

Mark Li

unread,
Dec 7, 2013, 9:28:06 PM12/7/13
to web...@googlegroups.com
My web2py.js is the same as the one shipped with the latest web2py.

I also tried adding a "data-w2p_disable_with" attribute to the input, but it didn't change to the attribute value:

<input data-w2p_disable_with="message" type="submit"/>


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/aT_YWu0Ublo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Martin Weissenboeck

unread,
Dec 8, 2013, 3:14:17 AM12/8/13
to web...@googlegroups.com
Same problem. It seems, that

<input data-w2p_disable_with="MSSG" name="submit1" type="submit" value="Back" />

has no effect.

By the way, I have found in gluon/html.py that something like

DIV('text', **{'_data-role': 'collapsible'})

could alo be written as

DIV('text', data={'role': 'collapsible'})

Regards, Martin



2013/12/8 Mark Li <markru...@gmail.com>
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

Niphlod

unread,
Dec 9, 2013, 3:01:31 AM12/9/13
to web...@googlegroups.com
this is really.... unexpected.
this line
https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py.js#L462
"selects" all the inputs in the form ... that syntax **should** leave out all inputs with a name attribute....
Can you pack a minimal app to reproduce the issue ?

Martin Weissenboeck

unread,
Dec 9, 2013, 3:21:54 AM12/9/13
to web...@googlegroups.com
ok, maybe during the next two hours.


2013/12/9 Niphlod <nip...@gmail.com>
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

Martin Weissenboeck

unread,
Dec 9, 2013, 5:54:07 AM12/9/13
to web...@googlegroups.com
Interesting. My minimal app does not show any "Working..." message.
I have to make more tests.


2013/12/9 Martin Weissenboeck <mwei...@gmail.com>

Mark Li

unread,
Dec 11, 2013, 4:01:39 PM12/11/13
to web...@googlegroups.com
I looked into the code and my web2py.js was not the same as the github link, which I noticed because my forminputclickselector did not contain
:not([name])
. When I diff-ed the original link for the newest web2py.js, with my current web2py.js, it showed no difference. Very odd, maybe I had an old web2py.js in browser cache. Sorry for the confusion.

Krzysztof Socha

unread,
Jul 7, 2015, 5:40:55 PM7/7/15
to web...@googlegroups.com


On Wednesday, December 11, 2013 at 10:01:39 PM UTC+1, Mark Li wrote:
I looked into the code and my web2py.js was not the same as the github link, which I noticed because my forminputclickselector did not contain
:not([name])
. When I diff-ed the original link for the newest web2py.js, with my current web2py.js, it showed no difference. Very odd, maybe I had an old web2py.js in browser cache. Sorry for the confusion.



I have the same problem now -all of my (non-submit!) buttons got 'Working...' message when submitting the form.
 I checked the github link again... The lines do not match anymore, but I have not found not([name]) anywhere now... How do I disable this behaviour?

Krzysztof.

Mark Li

unread,
Jul 10, 2015, 12:11:08 PM7/10/15
to web...@googlegroups.com
I am currently not using the newest version of web2py; I'll probably update in the near future and add a reminder to look into this.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/aT_YWu0Ublo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages