Hello,

If you are not using validators then when the checkbox is NOT checked
the variable privatebox will NOT be passed into the method so you
probably want to set a default value, preferably False.  But when the
checkbox is checked the variable privatebox should be equal to the
string "on" which evaluates to True.  So the following code should
work:

@expose()
def uploadfile(self, upload_file, file, privatebox=False):
  if privatebox:
    #Do something when its True
  else:
    #Do something when its False

Tell me if it still doesn't work.

-Ian

On 8/8/06, OriginalBrownster <[EMAIL PROTECTED]> wrote:
>
> I want to use a single checkbox within an existing form to indicate
> whether a file is to be uploaded to a public or private domain.
>
> Every part of the form is working. The upload of the file.
> However when I add the checkbox called privatebox
> I cannot pass the parameter into the controller
>
>
>
> <form action="uploadfile" method="post" enctype="multipart/form-data">
>
>         Enter in data about the file
>         <br/>
>         <input type="text" name="file"/>
>         <br/>
>         Would you like this file to be Private?
>         <input type="checkbox" checked="checked" name="privatebox"/>
>         <br/>
>
>
>         Filename: <input type="file" name="upload_file"/>
>         <br/>
>         <input type="submit" value="Upload"/>
> </form>
>
>
> In the form I call in private box
>
>     @expose()
>     def uploadfile(self, upload_file, file, privatebox):
>         if privatebox.checked=="True":
>
> However when I click the submit button I get an error saying that
> privatebox has no atribute checked.
>
> any help would be appreaciated
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to