Jump to content

Pull Image URL using Javascript element

Recommended Posts

Hello.  I have a file field where a user can load in an image. After they load the image and click update, I've got some java that runs. I'd like to populate the url of that image in another field.

I've got something like this that fires when the user updates, but I can't find the correct value for the image url and it clearly doesn't work:

document.getElementById("EditRecordtextfield_1").value = document.getElementById("EditRecordImage_File_1").SRC


Thought? Is this even possible?


Link to comment
Share on other sites

  • 2 weeks later...

Try this:


document.getElementById("caspioform").onsubmit= function (){
var str= document.getElementById("EditRecordImage_File_1").value;
var pieces = str.split("\\");
var filename = pieces[pieces.length-1];
document.getElementById("EditRecordtextfield_1").value = '[@cbBridgeServer]/dpImages.aspx?appkey=APPKEY  OF YOUR DETAILS PAGE HERE&file='+/filename;

Change APPKEY OF YOUR DETAILS PAGE HERE with the appkey of the page you are placing this code in the Footer for.

But the issue in here is that if you have the same file with the same name already, the name will get changed after submission and it is not going to be the same in URL anymore.

Link to comment
Share on other sites

  • 1 year later...


I am trying to get the image URL from a file upload field into a text field, so I can pass it to a Zapier webhook using JSON payload. I tried modifying the script above but it is not working. I thought that the image URL ends with a number and not file name? Can you advise how I can turn an image into text image URL?


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...