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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/0602c7fc-cab4-464e-a7dc-a2d597c0d478%40googlegroups.com.