Forum OpenACS Development: ad_form file widget

Collapse
Posted by Iuri Sampaio on
i'm trying to set a value as default to a file widget in an ad_form i built. in order to avoid NULL value at this field.

ad_form -html { enctype multipart/form-data } -export { folder_id lock_title_p name } -form {
file_id:key
{upload_file:file,optional {label \#file-storage.Upload_a_file\#} {html "size 30"} {value "test"}}
}

but the value isn't set. i try to pass it to a next page and it doesn't work. is it a bug on ad_form? wasn't it suposed to work and the word TEST shows up at the text box?

Collapse
2: Re: ad_form file widget (response to 1)
Posted by Jim Lynch on
Here is what I found out by looking and testing...

First, a "file" widget is one of many generic widgets that puts the type ("file" in this case) in the input tag.

So, the rendered input tag will look like this:

(less than sign) input type="file" name="upload_file" value="test" id="upload_file" size="30" (greater than sign)

As you can see, the value from your widget value definition is present in the input tag.

My only conclusion so far: that's the way file widgets work??

Collapse
3: Re: ad_form file widget (response to 2)
Posted by Jim Lynch on
err, last line should have been...

My only conclusion so far: that's the way HTML works?? That's the way file input tags work as specified in the html spec??

Because the file widget in openacs just makes a simple input tag... and (blindly?) sticks the value=test in there.