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?

DP

Link to comment
Share on other sites

  • 2 weeks later...

Try this:

 

<script>
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;
}
</script>

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...

Maymusic,

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

  • 5 years later...

Hello! Caspio releases another new enhancement to the WebHooks feature, refer below: 

Caspio Webhooks allows your applications to communicate with third-party systems in real time when changes to data occur. 
In this release, we introduced the following updates:

  • In non-HIPAA/Compliance accounts, webhooks logs now show the information sent and received.
  • All accounts, including HIPAA/Compliance, now can:
    • Send webhooks based on table events initiated by triggered actions and tasks.
    • Configure webhooks for tables with triggered actions enabled for the same event as the webhook. 
  • A single REST API call can be used to activate or deactivate all events for a selected webhook.

Source: https://howto.caspio.com/release-notes/caspio-47-0/#:~:text=Enhancements to Caspio Webhooks

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.

Guest
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.

Loading...
×
×
  • Create New...