Image on Formula URL Button using JavaScript

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Here's our formula URL button:

"javascript:" &

"var QBU_rid = '" & [Record ID#] & "';" &
"$.getScript(gReqAppDBID + '?a=dbpage&pagename=1stcorrectionenddate.js');" &
"void(0);"


We would like to use an image instead of a button, but this has proved to be challenging with the button. Any help would appreciated!

-Rick


Photo of Rick

Rick

  • 10 Points

Posted 4 years ago

  • 0
  • 1
Photo of gmcroberts

gmcroberts

  • 180 Points 100 badge 2x thumb
You can't apply an image to a button in a formula URL field, but you can create a button using an image in a Formula Text field when you enable the field to allow HTML, and still use your Javascript
Photo of Rick

Rick

  • 10 Points
Would the formula be the same as above? We've tried to use similar formulas with the Formula Text field and had no luck.
I don't know the answer, but I have heard Dan Diebot say that the href interferes with the "escaping" of the special characters.
Photo of Rick

Rick

  • 10 Points
That's what I thought too, Mark, but I'm unable to resolve what is "escaping" - if anything at all from our formula.
Photo of Ammar

Ammar

  • 312 Points 250 badge 2x thumb
1-Change the field type to a "Formula Text" and allow html tag2-Add "<img src='valid source' onload='your script goes here' hidden>"
Now, the form will try to load the image and run the script, the image is hidden so you will not see. You would need a valid source to the image ( Could be a company logo ) so the image will not return an error.