Is there a way to trigger a picture upload through a button or icon instead of picture uploader?
Sure. One way would be to include the picture uploader as a 1x1 pixel element so itâs not really visible to the user. Then, when someone clicks, say, a button elsewhere on the page you could run some javascript to click the picture uploader. Itâd look to the user as if clicking the button opened the picture upload screen.
What if you put a group element on top of the picture and have that group clickable?
That is a really good idea! Would you be able to share javascript piece of code how to start the workflow? I installed the toolbox plugin to run it. Many thanks!
Youâd just need a line of js code that clicks the element based on the elementâs ID - plus, youâll need to add an ID to the element. I donât have the JS but Iâm sure someone has posted some JS in the forums thatâd work for this.
I got to this point: I have this js line: $( â#myElementâ ).click(); which spouse to trigger in my case picture uploader, however havenât managed to make it work yet. I think it is something to do with element ID. Maybe you would know how do I define it?
If you click to edit the element, there should be an element ID field at the very bottom.
If there isnât, then youâd need to go to the editor and turn on element IDs (itâs in settings and near SEO options)
Using the toolbox plugin you are going to create a workflow that runs JavaScript.
As direct above, give your picture uploaded the an ID, in my example letâs say itâs
photoclick
Then in the run JavaScript work flow put the following code
document.getElementById(âphotoclickâ).click();
That should do the trick
thanks, however it doesnât seem like working ether.
maybe it possible can not locate the element in the document?
I see this is an old thread however still it looks unresolved, I just ran into this issue and the solution that worked for me was to use the javascript with the toolbox plugin using the following code
document.getElementById( âid-nameâ ).getElementsByTagName( âinputâ )[0].click();
I hope that helps.
I defined an ID for my picture uploader however I am not sure what tag name means. I used input, picture uploader, picture and it didnât work. When I use the code without getting the elementâs tag name it still doesnât work.
Hey, just use this java code: $(â#pictureuploader inputâ).click()
where pictureuploader is your ID attribute.
with the code:
document.getElementById("id-name").getElementsByTagName("input")[0].click();
you only need to change id-name for your id you have set in bubble, the rest is just targeting the input within the object⌠in other words you donât need to change the TagName.
@d.norkus solution is doing the same thing just using jQuery which will also work.
I get an invalid token error if I donât check âAsynchronousâ but either way still no result. Here is a test app:
What I am doing wrong?
I canât access the app, Iâd be happy to jump on a Skype call and help you get it working.
Instead of JS, you could use a default image or restyle the uploader so it looks like a button.
I also canât view your app, however have you ticked on ID attribute checkbox in general settings? It could also produce an issue if element is placed in a repeating group or your browser is blocking pop ups⌠I canât think of what more could be failing in this case.
Thanks everyone for replying. Here is the link to the app https://huhuhgkgkg.bubbleapps.io/version-test?debug_mode=true
But how can I share the app so you can view and edit it?
Goto Settings --> General --> Privacy & Security --> Application Rights --> Make it editable and share the link on address bar