How to use stdlib.upload without rendering the whole page in a hidden iframe?
Given the example chat room code in manual, I want to add a form for user to upload image using the Upload.html 开发者_高级运维function in standard lib. Below is the upload form code I wrote wraps in a div tag.
{Upload.html(
{form_id = "upload" url_parameters = params()
form_body =
<input type="file" name="upload" />
<input id=#entry onnewline={_ -> broadcast(author, room_name)} />
<input type="submit" onclick={_ -> broadcast(author, room_name)} value="Post" />
process = save_image})}
Now I notice in my DOM, there is now an iframe element that renders a second set of input methods inside, and they are also binded to the broadcast function, which appends user's new message to the chat log. So now every time I hit submit, two messages will get appended to the chat log instead of one. Is there a Upload.config setting I can use to avoid this problem?
This looks pretty much like a bug in the upload library. We'll try to fix it asap and provide you a patch (in case you compile Opa from source). I don't think you can work around the bug at the user level, unfortunately.
精彩评论