Change the '{{=qtnBtn}}' into 'input', it should work. I guess the reference is wrong (not dynamic).
On Friday, September 27, 2019 at 2:24:43 PM UTC-4, mostwanted wrote: > > Hey @Mark, thanks for replying but none of the solutions are working! I > fixed disabled & replaced attr() with prop() & ultimately with hide() but > nothing seems to be working! > > On Friday, September 27, 2019 at 7:09:39 PM UTC+2, Mark wrote: >> >> 'disbled' should be 'disabled'. If it doesn't work, I think you can try >> to use hide(), or prop('disabled', true) >> >> >> On Friday, September 27, 2019 at 6:48:54 AM UTC-4, mostwanted wrote: >>> >>> I'm using SQLFORM.factory() to capture a specific detail but i want it >>> to be submitted once, to avoid the mistaking of possibly submitting it >>> again I want the button to be disabled immediately after the first >>> submission. I tried this below but it's not working, how can i make it >>> work?? >>> >>> *CONTROLLER* >>> def invoice(): >>> ref=SQLFORM.factory(Field('Quotation_reference',label=SPAN('Quotation >>> Reference', _style="font-weight: bold;"), widget = lambda field, value: >>> SQLFORM.widgets.string.widget(field, value, _class='my-string', _id= >>> 'quote_number', _placeholder='N:B; Always remember to enter & submit >>> the quotation number first & always enter it once!'))) >>> >>> qtnBtn=ref.element('input',_type='submit') >>> >>> if request.vars.Quotation_reference is None: >>> ref2='' >>> else: >>> session.ref2=request.vars.Quotation_reference >>> >>> return locals() >>> >>> *VIEW* >>> {{extend 'layout.html'}} >>> <script> >>> $(document).ready(function(){ >>> $('{{=qtnBtn}}').click(function(){ >>> $('{{=qtnBtn}}').attr('disbled', true); >>> }); >>> }); >>> </script> >>> >>> {{=ref}} >>> >>> >>> Regards; >>> >>> Mostwanted >>> >> -- 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 the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/9bc5df74-2a24-4ac7-b27f-1c1f2e00b629%40googlegroups.com.