Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

adding a script to a A HREF

Featured Replies

I am sure the answer is obvious, but I just have no clue at this point.

I have made a link..

<p><A href="http://65.69.30.194/downloads/[FMP-Field:Img1_downloadlink]"><strong>Begin Download</strong></A></p>

I would like to add a script...

<p><A href="http://65.69.30.194/downloads/[FMP-Field:Img1_downloadlink]&-script=Img1_downloadcounter"><strong>Begin Download</strong></A></p>

Why isn't this working for me? What can I do to solve this problem?

I should also note that this link is inside of an existing form, but I need the sript to run when clicking the link, not when submitting the form. And all the script is doing is increasing the value of a field by +1.

If you are not talented enough to figure that out, then you are not talented enough to run a ScriptMaker script safely over the web.

Do yourself a favor and use a calculation.

Hi, hoek! Hmm.. most CDML links I have made all end in ACTION commands but I see your first one does not since it is just substituting field information for a path from some previous FIND or something you must already have in your website. When you want your link TO DO something, I think you need to use one of the ACTION tags (-new, -find, -edit, etc.). In your case, you may want to use a -findany if you don't really need it to do anything but the script.

Read more about CDML links, though. When you use an action you'll need to include things like -db, -lay, etc. in the link, too.

Hope this helps!

--ST

LOL...patience levels are LOw

Oh, by the way... Unable is correct about scripts over the web. Usually, you want to avoid them unless your solution will not have a problem with multiple users executing the script at the same time. For example, I am going to try to use a script that needs to execute at some point that is not specific to the user executing it... just house-cleaning script. I have not tested it yet, but don't anticipate any problems (like we ever do, eh? lol!).

--ST

You didn't specify any valid FM WC action like -FindAll or -Edit.

  • Author

I am not here for the abuse. I came here for help. Obviously I am not talented enough. If I was talented enough, I wouldn't have posted the question. Weren't you a novice once?

OK. That felt good.

I want to design a link that will initiate a download of a file, then change a field value by +1. So somehow I need to add the fact that I want to -edit. Thanks for the help with that Anatoli. And i now understand that i need to point to a database, layout, and format.

<p><A href="http://65.69.30.194/downloads/[FMP-Field:Img1_downloadlink]"><strong>Begin Download</strong></A></p>

coluld someone modify this line to give me some direction?

This one works for me:

<script>

function addone()

{

document.myform.amount.value = (document.myform.amount.value - 0) + 1 ;

document.myform.submit();

}

</script>

</head>

<body>

<form name="myform" method="POST" action="FMPro">

<input type="hidden" name="-db" value="combotest.fp5">

<input type="hidden" name="-lay" value="web">

<input type="hidden" name="-format" value="hworldimage.html">

<input type="hidden" name="-recid" value="[FMP-CurrentRecID]">

<input type="hidden" name="amount" value="[FMP-Field:amount]">

<input type="hidden" name="-edit">

</form>

[FMP-Field:amount]<br><a href="[FMP-Field:Img1_downloadlink]" onclick="javascript:addone();">Begin Download</a>

</body>

OR, try this:

</head>

<body>

<form name="myform" method="POST" action="FMPro">

<input type="hidden" name="-db" value="combotest.fp5">

<input type="hidden" name="-lay" value="web">

<input type="hidden" name="-format" value="hworldimage.html">

<input type="hidden" name="-recid" value="[FMP-CurrentRecID]">

<input type="hidden" name="-script" value="Img_downloadcounter">

<input type="hidden" name="-edit">

</form>

[FMP-Field:amount]<br><a href="[FMP-Field:Img1_downloadlink]" onclick="document.myform.submit();">Begin Download</a>

</body>

All the best.

Garry

Don't be a whiner.

OK. That felt good.

Cheese and crackers, don't be so damned sensitive. I gave you very good advice, "Do yourself a favor and use a calculation."

Pay attention.

Think!

You can find such an incrementing calc and other ideas here. laugh.gif

Or you can use the JS suggested by Garry.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.