This is the code segment that I am having issues with: I have highlighted the areas that are not working. if something sticks out and you can help I apreciate it.
@auth.requires_login() record = db(db.bike.bike_identifier != "").select()[0] assert(record != None) form = SQLFORM(db.bike, record, showid=False) # Default a form value #form.vars.bike_identifier = record.bike_identifier form.add_button("Cancel", URL("index")) *form.add_button("Print_Tag", URL("tagprint", args=record.bike_identifier)) * form.process() #onvalidation=onValidate) if form.accepted: #TODO redirect(URL('home')) redirect(URL('grid')) #elif form.errors: # session.flash('Form has errors.') #if form.record_changed: return locals() # Print completed tags @auth.requires_login() def tagprint(): Title = "For Sale" req = request.vars['bike_identifier'] * Rows = db(db.bike.bike_identifier==request.args(0)).select() * for row in Rows: bike_identifier = row.bike_identifier serial = row.serial make = row.make model = row.model size = row.size color = row.color style = row.style date_of_receipt = row.date_of_receipt repairs = row.repairs_done price = row.price return dict(Title=Title, req=req) On Sat, Nov 17, 2012 at 8:26 PM, Anthony <abasta...@gmail.com> wrote: > Do you mean request.args(0)? There is no request.vars(0). Maybe it would > help if you could show all the relevant code and describe the workflow (if > possible, you can simplify the code to the minimal code that reproduces > your problem). > > Anthony > > > On Saturday, November 17, 2012 9:03:53 PM UTC-5, Paul Rykiel wrote: > >> I have a variable that I am moving the request.vars(0) into and when i >> look at in the HTML view it has a NONE value. it is strange to me, because >> it has to have this value in order to fill out the original SQL form. I am >> pulling from the form, and I even tried to pull it from the record variable >> which loads the data from db.bike. >> >> thanks for any help you can offer!! >> Regards, >> >> On Sat, Nov 17, 2012 at 6:36 PM, Anthony <abas...@gmail.com> wrote: >> >>> Can you be more specific -- what does "not working" mean? Does your >>> query actually pull a record, and does the record include a value in the >>> bike_identifier field? If so, the button url should include the >>> bike_identifier value as an arg -- is that the case? Is it breaking down >>> somewhere else? >>> >>> Anthony >>> >>> >>> On Saturday, November 17, 2012 6:16:02 PM UTC-5, Paul Rykiel wrote: >>> >>>> well...that is not working, but I will keep working at it. mostly I >>>> just wanted to make certain that I wasn't doing something incorrectly. >>>> >>>> On Sat, Nov 17, 2012 at 5:09 PM, Paul Rykiel <ptry...@gmail.com> wrote: >>>> >>>>> as you can see I am still learning, but getting more comfortable, I >>>>> didn't know that was a possibility. I will try thank you for your >>>>> response!! >>>>> Safe travels!! >>>>> >>>>> >>>>> >>>>> On Sat, Nov 17, 2012 at 5:02 PM, Anthony <abas...@gmail.com> wrote: >>>>> >>>>>> @auth.requires_login() >>>>>>> def repair(): >>>>>>> ## TODO Need to add a way to find the bike_identifier. >>>>>>> ## For now, just get the first bike listed. >>>>>>> record = db(db.bike.bike_identifier != "").select()[0] >>>>>>> assert(record != None) >>>>>>> form = SQLFORM(db.bike, record, showid=False) >>>>>>> # Default a form value >>>>>>> #form.vars.bike_identifier = record.bike_identifier >>>>>>> form.add_button("Cancel", URL("index")) >>>>>>> *form.add_button("Print_Tag", URL("tagprint", args=form.vars. >>>>>>> bike_identifier)) >>>>>>> * form.process() #onvalidation=onValidate) >>>>>>> >>>>>> >>>>>> First, when the form is first created, there are no request.vars and >>>>>> therefore no form.vars, so form.vars.bike_identifier will be None. >>>>>> Second, >>>>>> even once the form is submitted and there are some request.vars, >>>>>> form.vars >>>>>> will not be filled in until after you call form.process(), so >>>>>> form.vars.bike_identifier will still be None at the point where you are >>>>>> accessing it. >>>>>> >>>>>> Perhaps instead you want: >>>>>> >>>>>> form.add_button("Print_Tag", URL("tagprint", args=record. >>>>>> bike_identifier)) >>>>>> >>>>>> Anthony >>>>>> >>>>>> -- >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> -- >>> >>> >>> >>> >> >> -- > > > > --