URL Field

I have a wood shop database. One of the fields is a filed I use to display the manuals called view. The manuals are pdf files located in the directory woodshop/pdf_files.
I would like to be able to put a button in the view column that would link each manual.
I have in the database field manual router_manual.pdf so the link would have to add http://localhost/woodshop/pdf_files/ to the link.

the page would something like this

Name View Manual
Router View

You must have a field in your database with the link to each file PDF
Then in your form the field with the link must be type URL, so can show link to each manual.

I do have the field link call view. But I don’t want it show the URL. I want the user to see a button called View and when they click on it the URL is used.

You can create a new field for that.
create a field bt_pdf and in event onloadrecord set:

{bt_pdf} = “<img src=’…/_lib/img/sys__NM__YOURIMAGE’ onclick='downloadfile(”.{FIELDWITHLINKPDF}.")’ draggable=‘false’ title=‘VIEW FILE:’ />";

and must create a javascript function:

function downloadfile(thefile) {
document.location = thefile;
}

I have a database field named manual in that field is the file location of the PDF, example: /pdf_files/drillpress.pdf
So can you show me a example using my field and file name?
I do not have a image so I assume I need to find a button image.
Not sure what goes in the JS function. Can I just put {manual} in place of the (thefile)?

Thank you for your help.

{bt_pdf} = “<img src=’…/_lib/img/sys__NM__YOURIMAGE.jpg’ onclick='downloadfile(”.{manual}.")’ draggable=‘false’ title=‘VIEW FILE:’ />";

If you are asking how to make a button do something, there is an example here:

[ATTACH=CONFIG]n79394[/ATTACH]

From webinar: Rental Management System - 1/2: https://www.youtube.com/watch?v=Pe0npT3InJU

house.png

Here is the code I put in the onRecxord event. {bt_pdf} = “<img src=’…/img/click_to_read.png’ onclick='downloadfile(”.{url}.")’ draggable=‘false’ title=‘VIEW FILE:’ />";

function downloadfile(thefile) {
document.location = thefile;
}

Not working. As you can tell am lost.

You can see the video that says JACK, there explains how the process is done. Specifically the second video. Minute 20.
https://www.youtube.com/watch?v=fDlScZC0wpg

@gehrenfeld did you get it. If not, I’ll post what I use when I get a minute. Basically, in my grid I create a new field, in your case ‘view’, then in the events ‘onRecord’ I have some code that puts a PDF file link.

I watched the video but it didn’t really help me much. I have a field which has the folder path to where the pdf manual located. When I run Scriptcase I see the folder path in the field. I want to be able to click on the field and have the pdf file load in a browser ( I do not want it download to another location). I would also like to not show the folder path but instead just have a label there that says view,

in the onrecord

{bt_pdf=’ <button onclick="window.open(‘http://www.yourfilelocation/yourfiles’)>View PDF</button>

for this bit http://www.yourfilelocation/yourfiles you need to change to your filename on record, so for example if your file name is 1st.pdf and its in the database as a field called {pdfurl}

change to http://www.yourfilelocation/"’.{pdfur}.’"

​if this does not help message me the two fields used and i will write it for you.

I feel really stupid I am not sure what the filename on record. The screen shot shows that I have the url showing. I want to just show a View icon and not the link. This is a grid view. [ATTACH=CONFIG]n79438[/ATTACH]

Capture.PNG

{bt_pdf}=’<button onclick="window.open("http://localhost/woodshop/pdf_files/plans/"’.{view}.’")>View PDF</button>’;

{view} is the field my guess is its not called that so replace it with the real field name ’

if using a form then make sure it is a label field.

you will get the attached then.

you can add bootstrap styles after this is you like the button code I gave you will be just standard html button.

Screen Shot 2017-08-12 at 18.14.50.png

Okay this what I have done.

  1. Made a a field called bt_pdf.
  2. In the event onRecord I put {bt_pdf}=’<button onclick=“window.open(“http://localhost/woodshop/pdf_files/plans/”’.{url [ATTACH=CONFIG]n79447[/ATTACH] }.’”)>View PDF</button>’;

As you can see it works except when I click on the View PDF button nothing happens.

screen.PNG

{bt_pdf}=’<a href=“http://localhost/woodshop/pdf_files/plans/"’.{url}.’" target=”_blank">View PDF</a>’

try this replacing {url} with your field you use

Parse error: syntax error, unexpected ‘$_SESSION’ (T_VARIABLE) in C:\Program Files\NetMake\v9\wwwroot\scriptcase\app\woodshoop\grid_plans\grid_plans_grid.class.php on line 2280

error I get put {bt_pdf}=’<a href=“http://localhost/woodshop/pdf_files/plans/"’.{url}.’" target=”_blank">View PDF</a>’ in the onRecord event. If you look at me last screen shot the fourth column is the {url} field and the {bt_pdf} is the last column.

Here are the fields and their type.

[ATTACH=CONFIG]n79456[/ATTACH]

field.PNG

use exactly this below copy and paste.

{bt_pdf}=’<a href=“http://localhost/woodshop/pdf_files/plans/"’.{url}.’" target=”_blank">View PDF</a>’;

Getting closer. I worked somewhat here is what I am getting now.

[ATTACH=CONFIG]n79462[/ATTACH]

dir.PNG