Given I have the following sweet alert js:
------------------------------------------------------------------------------------------
(async function getCompany () {
const inputOptions = new Promise((resolve) => {
setTimeout(() => {
resolve(myargs)
}, 2000)
})
const {value: company} = await Swal.fire({
title: 'Select Company',
input: 'radio',
inputOptions: inputOptions,
inputValidator: (value) => {
return !value && 'You need to choose something!'
}
})
if (company) {
Swal.fire({html: 'You selected: ' + company})
}
return company
})
()
--------------------------------------------------------------------------------------------------------------
And i have the following code in the view:
{{if CHOOSE_COMPANY == 'Y' : }}
{{ print "LOGIN view : choose: \n", CHOOSE_COMPANY }}
{{print "LOGIN view : swalcompany fired \n"}}
{{print "JSARGS is :\n", js_args}}
{{=ASSIGNJS(myargs=js_args)}}
<script>{{=ASSIGNJS(myargs=js_args)}}</script>
<script>var html_post = "center"</script>
<script src="{{=URL('static','js/swal/swalcompanycode.js')}}"></script>
{{pass}}
AND in the controller:
if in_form.process(session=None, formname='login').accepted:
print "LOGIN: Accepts...\n"
response.flash = 'form accepted'
FRM_ERR = 'N'
CHOOSE_COMPANY = 'Y'
print "LOGIN: Accepts Trying the return \n"
return dict(form=in_form, FRM_ERR=FRM_ERR, js_args=js_args,
CHOOSE_COMPANY=CHOOSE_COMPANY)
redirect(URL('buttonbar'))
elif in_form.errors :
print "LOGIN: error...\n"
response.flash = 'form has errors'
FRM_ERR = 'Y'
return dict(form=in_form, FRM_ERR=FRM_ERR, js_args=js_args,
CHOOSE_COMPANY=CHOOSE_COMPANY)
I'm trying to accomplish 2 things:
A: get some value backup from the javascript file and
instead of the "return" under the accepted section of controller code, want
to set
a session value and then continue on to the redirect.
How do I go about doing both of theses's ??
As always, Thanks ...
\
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division
--
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].
For more options, visit https://groups.google.com/d/optout.