I would like to open and write to a new file after accessing form variables
passed from views...
I've been trying to find a similar problem, but not much luck ..
I suppose I can create another table with tempfile field of type uploads,
and then do a database controller within the controller..
This is working, I am able to upload a file containing information from the
session, but when I try displaying SQLFORM.grid in the next view, it says
no records found..but the upload was successful because the file is in my
uploads folder. So I think I am doing something wrong with my
EDIT:
The example I described will upload a file, however it uploads 3 files
instead of 1 file.
The controller function looks like :
def upfile():
vars = request.vars
arrvars = []
//I populate and sort array
//open a template file from static and write to it
I am not sure if I worded my question correctly, sorry for confusion.
Consider:
db.define_table('form1',
Field('number', 'integer'),
Field('field1', 'string'),
Field('field2', 'string),
Field('field3', 'integer'))
db.define_table('formfile',
Field('number_id', db.form1),
Is it possible for me to do jquery within the controller??
So after form.process().accepted I can hide the div containing the form and
show a div which will contain a button that the user can click and this way
I will be able to pass the variable from the view into another controller?
I've
I fill an empty array with form values in a single view,
how am I able to pass this array into a new view so that I can do what I
want with the values in the new controller after the form is submitted?
I try doing something like the following within my controller containing
the form:
if
Given the table :
db.define_table('form1',
Field('field1, 'string'),
Field('field2', 'string'),
Field('field3', 'integer'),
Field('form1_file', 'upload', compute=fpost))
If a user is starting a form session and enter the value 2, they submit
values for:
field1_0, field2_0,
Instead of removing the upload/compute field and making a separate table
for that.. Is this something a virtual field can be used for?
I'm still trying to read more on virtual fields and gain an understanding
but essentially the compute field will call onto a class which is being
passed the
Or maybe would I have to construct a class within the models file so that
it is called in form1compute each time, and the values from row are passed
to it and saved in an array within that? I'm not that advanced with python
but I think I need the class in order to actually continue to append
I've been struggling with trying to figure out how this can be achieved
...not sure if it can be.
In db1.py I have a table defined..example:
db.define_table('form1',
Field('field1', 'string'),
Field('field2', 'string'),
Field('field3', 'integer'),
Field('form1_file', 'upload',
What worked for me was utilizing row.values(), because I was doing this
within the models file!
I haven't been able to find any documentation in regards to using it but
that is what I was looking for! Thank you!
On Tuesday, March 15, 2016 at 2:15:12 PM UTC-7, Val K wrote:
>
> Hi!
> Just for
I have a table defined with 3 input fields and then an upload field. The
upload field is used to take the values that are entered by the user and
input them into a file which contains all form field values from the
session.
The form is generated dynamically, so the number of form fields varies
Yes this is ideal but I didn't think that would be possible to implement,
because with this way the amount of columns would vary with each row and I
am unsure of how possible it is to make it work because of that
On Wednesday, March 2, 2016 at 5:12:06 AM UTC-5, Dave S wrote:
>
>
>
> On Tuesday,
That makes so much sense! Thank you for explaining this to me, I did that
and it finally works!
I also changed the variable name to be nums to make things clearer as well.
I am having trouble with inserting the items accordingly in the database,
attached is a photo of a form submission I just
What do you mean by passing it through url?
I am obtaining the value that is entered using request.vars, if I wasn't
passing the value then it wouldn't be creating the entered amount of form
fields, and it does this correctly. It only raises this error when I try
submitting the form, which is
Can someone please tell me why I am getting this error and how to fix it?
numpatients = int(request.vars.name);
int() argument must be a string or a number,
not 'NoneType'
*db.py*
db.define_table('post',
Field('patient'),
Field('attime'),
Based on the error with the code I currently have..
I think a more concise way of wording exactly what I want to do is...
Create multiple instances of the* form fields* within a* single form*...
On Tuesday, February 23, 2016 at 2:41:58 PM UTC-8, aetag...@gmail.com wrote:
>
> That does make
That does make sense, now if only I can get my code to work so that I can
see what happens with the table.
*CONTROLLER:*
def index():
return dict()
def form1():
numdays = int(request.vars.name);
forms = [SQLFORM(db.post,formname='form%i' % k) for k in range(numdays)]
for k,form
I've been having trouble understanding how this works and could be achieved
with web2py, it seems like this concept exists within Django so I want to
understand how this can be implemented within web2py.
Example scenario:
A doctor logs onto the web2py application and they go onto a page which
For the first method, will I be able to essentially map each instance of
form values to their database inserts? Kind of like if the user enters 5
days, 5 copies of form fields are made. The first copy maps to the first
day, second copy maps to second day, etc?
As for the second method, if I am
Something like this:
User inputs x amount of days, using jquery I will have buttons of some sort
that represent x amount of days which appear when the user specifies x.
They will then be able to click each button, where an instance of the form
is displayed and they can enter information for
I'm not sure if this is even possible, but if it is..how would something
like this work:
You prompt the user for an x amount of days, then with javascript and
jquery you have x amount of buttons appear. Each button is an instance of
the form. There is a variable within the javascript that
I am sure this is a problem with openpyxl and not web2py, although I do not
understand exactly why it is happening. Is there a way around it or to fix
it?
When I submit the form the error is:
* Cannot convert['Yes'] to Excel*
Here is the code:
q = ('Yes', 'No')
def surv_excel(row):
I tried doing:
...
wb = load_workbook(filename= os.path.join(request.folder, 'static',
'survey.xlsx'))
cells = wb['Sheet1']
if row.n1 == 'Yes':
cells['I8'] = 'Yes'
else:
cells['I8'] = 'No'
Doing this allows me to submit the form without error..but when I open the
I tried that, and although it allows the form to submit without any
tickets.. it appears that it messes up something in openpyxl because it
does not upload a file
On Wednesday, January 6, 2016 at 3:56:06 PM UTC-5, Richard wrote:
>
> What about :
>
> if row.n1.split(',') == 'Yes':
>
> Richard
>
Okay, I got it to work with this:
wb = load_workbook(filename= os.path.join(request.folder, 'static',
'survey.xlsx'))
cells = wb['Sheet1']
if row.n1 ==* [*'Yes'*]*:
cells['I8'] = 'Yes'
else:
cells['I8'] = 'No'
Just needed the brackets because it is from a
Thank you for your responses, I finally figured it out. You are very
helpful!
On Tuesday, December 29, 2015 at 10:48:16 AM UTC-8, Anthony wrote:
>
>
> step = 0
>> for i in STEPS:
>> if step == 0:
>> session.myformt = {}
>> fields=STEPS[i]
>> print
I am forever having trouble with making the form wizard show all the steps
in one page, all it shows now is the last batch of form questions instead
of the previous batches and although the database gets updated with the
entry, a file that is supposed to be uploaded into the database isn't.
Doesn't that defeat the purpose of using a form wizard, since I can use
jquery effectively without it all on the same page?
Or do you mean that the form wizard helps with shortening code with this
because instead of hiding/showing fields one-by-one, it can somehow allow
me to do this using the
Is it possible to implement something equivalent to a drop down menu within
a form wizard?
I want to display a menu which exists on each page of the form, so that the
user can select which step to go to, they can select the step in the menu
and it redirects them to that step.
The problem is
I've been trying and failing with trying to get that to work with the form
wizard, it works without it.
The conditional fields just don't work at all, the form proceeds as normal
showing every field in every step. I don't know if I am just placing things
in the wrong place or what.
step =
I want to break up the form into large chunks to make it easier for the
user, yes.
I have 5 steps defined containing the fields, and then changed the code to
the following so that the entire form is displayed on the page with the
following:
STEPS = {0: ('fields1', 'fields2', 'fields3'),
I added field type as double for those fields and that fixed, it's just
strange that it didn't catch that error before.
Thank you
On Thursday, December 24, 2015 at 9:07:12 AM UTC-8, Anthony wrote:
>
> I don't think this has anything to do with the wizard. Looks like all of
> your numeric
How do I use that jquery form wizard plugin? I extracted it into my modules
folder but it does not work, I also tried extracting it in my static/js
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
Using the form wizard, user inputs values into fields and upon completion
of form is redirected to sqlform.grid page, where the uploaded file can be
viewed, this all works. The problem is when I try to view the database I
get this error:
*def formatter(self,value): return '%.2f' %
I looked into the form wizard, and this worked great for what I was trying
to do. Thank you!
On Wednesday, December 23, 2015 at 12:54:01 PM UTC-8, aetag...@gmail.com
wrote:
>
> I have a form that is rather long, therefore I want to split it into
> sections.
> I am doing this with jQuery
I can't find any documentation on pagenation being used with forms.. would
this all be better achieved with jquery? I have no experience with that but
I would think that it would be possible to display the first set of
questions, then upon the click of a button, that set of questions are
I have a form that is rather long, therefore I want to split it into
sections.
I am doing this with jQuery conditional fields in forms.
The first 5 fields appear, once the user enters input for the fields and
then they click on a checkbox, the filled fields are then hidden and the
next 5
I have a form that opens a excel file template, all inputs in the form
correlate to a cell within the template. When the form is submitted, the
new excel file is saved for that user.
I am trying to find the best way to implement the following:
I want to open the existing uploaded file, and
Update: I fixed the ticket error I was getting, it was because the name of
the model file came before the db.py where I initialized it. Now I can see
what the form is doing..and it is continually asking input for day1
repeatedly after every submit.
--
Resources:
- http://web2py.com
-
Of course I would do something like that. It works now! Thank you so much
for your help and explaining everything.
On Tuesday, November 24, 2015 at 6:05:52 PM UTC-5, Anthony wrote:
>
> In the model, you changed the field name from "location" to "located"
> (probably because "location" is a
Also.. To add to my other post below..I was reading on the SQLFORM.factory
and it seems like that may be a viable options as well for what I am trying
to do. Here is the section I am referring to:
*"SQLFORM.factory*
*There are cases when you want to generate forms as if you had a database
Hello,
I am very new to web2py. I was hoping for some insight as to whether what I
am trying to do is possible, and maybe if I can be redirected as to what I
should read up on to help me figure this out. Any advice or insight will
help.
I have web forms, which are linked to an excel file
Model:
db = DAL('sqlite://webform.sqlite')
db.define_table('excelform',
Field('last_name', 'string'),
Field('first_name', 'string'),
Field('age', 'string'),
Field('location', 'string')
)
That is one of my models, I have another that contains:
Thank you, that makes much more sense. I really appreciate it!
Also, in regards to the redirect..are you suggesting I may not want to do
that for this application?
Because I was intending on making that a confirmation page with the
submitted information, I thought redirect would be the best for
Hello, I am very new to web2py.
This is my goal:
I want to open an existing Excel file and have a user submit data into a
form on a webpage. The form is connected to specific cells within the
existing Excel file. When they submit the form the data is saved into a new
file, traced to that
46 matches
Mail list logo