Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Form Button with Javascript  (Read 9895 times)

gailwilk59

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
Form Button with Javascript
« on: October 30, 2018, 07:51:41 AM »

I have created a form template that needs to be flattened, saved and emailed.  At the bottom I inserted a form button to do this, assigned an action (mouse down) and inserted the script.  However, the button changes briefly when pressed, but it does not appear to run the javascript.  The same script works fine when assigned an icon and placed on the toolbar.  I've never used the "button" before or the javascript feature.  And, yes, I have JavaScript enabled in my preferences. Any ideas?
The script is as follows:

Flatten(false,65536)
SaveAs("pdf")
Email()
Logged

Steve

  • Administrator
  • Sr. Member
  • *****
  • Karma: +7/-0
  • Posts: 367
    • RevuHelp
Re: Form Button with Javascript
« Reply #1 on: October 30, 2018, 08:34:54 AM »

I'm not a JS person at all, but pulling waaaaayyyy back from my HyperCard programming days, you almost always wanted buttons to act on the MOUSE UP command.  Not MOUSE DOWN.   What happens if you switch to on MOUSE UP?
Logged
Steve Jones
RevuHelp Forum Admin
steve@revuhelp.com
www.revuhelp.com
www.facebook.com/RevuHelp

gailwilk59

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
Re: Form Button with Javascript
« Reply #2 on: November 01, 2018, 08:11:29 AM »

Same result. :(
Logged

Maxime.Vezeau

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 9
Re: Form Button with Javascript
« Reply #3 on: December 11, 2018, 04:57:33 PM »

I have created a form template that needs to be flattened, saved and emailed.  At the bottom I inserted a form button to do this, assigned an action (mouse down) and inserted the script.  However, the button changes briefly when pressed, but it does not appear to run the javascript.  The same script works fine when assigned an icon and placed on the toolbar.  I've never used the "button" before or the javascript feature.  And, yes, I have JavaScript enabled in my preferences. Any ideas?
The script is as follows:

Flatten(false,65536)
SaveAs("pdf")
Email()

Your commands are not in JavaScript, they are built-in commands in Bluebeam and won't work where you put them.

I'll split this into two parts: 1.What you can do in JavaScript 2.What you can do with BlueBeam

If you absolutely want a button on your PDF, go with #1. If it's you and your team, and you don't mind adding another button on your toolbar, go with #2.

1.
Here is what I found with some success. Keep in mind I'm relatively new to this coding language.

For your Flatten:
Code: [Select]
this.flattenPages();
Note that you will not be able to unflatten.
Also if you want a specified range of pages, add something like:

Code: [Select]
this.flattenPages({
    nStart: 0,
    nEnd: this.numPages - 1,
    );}

Flatten always worked for me.

For the e-mail:
Code: [Select]
this.mailDoc({
    bUI: true,
    cTo: "me@myself.ca",
    cCc: "",
    cSubject: "I am the one who e-mails",
    cMsg: "This is a message \n",
});

It worked, but not all the time. Something in the background is blocking it, I'll check this at some other time. Otherwise, It should work fine.

Saving..... is another matter...

Code: [Select]
this.SaveAs("/C/Users/User_name/MyDocuments/" + "apple_juice.pdf");
Should have worked but it didn't  ???

2.
In the Document or Batch menu select Script.

Click on the Plus Sign " + " of the Script Manager.

Name the script however you like and choose the icon you want.

Copy and paste your functions in the script box.

Code: [Select]
Flatten(false,65536)
SaveAs("pdf")
Email()

Press "Ok" select it under Scripts and press Run.

It should work as intended.

You can get your script onto your toolbar. It is under the Script Category in the Customize Toolbar menu.

If you have any questions, let me know. I assume you are on the latest version of the software.
« Last Edit: December 13, 2018, 08:50:08 AM by Maxime.Vezeau »
Logged

GRonkette

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 1
Re: Form Button with Javascript
« Reply #4 on: April 16, 2020, 02:50:36 PM »

Has anyone come up with a solution for this?  I have the button and it will open an email and populate the To:, CC:, Subject and Body with information from my form but I can't get it to save as.  Does Revu just not have the API to Save As like Adobe's this.SaveAs?  They list a save feature on the help forum but it doesn't work, see link below.  I have the latest version of Revu 2019.1.16 and JavaScript is turned on.

https://support.bluebeam.com/wp-content/uploads/2020/01/Bluebeam-Script-Reference-2019.pdf

This would be very useful for a couple forms that we have created for my business. Thanks,
Logged

xmehrban

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
Re: Form Button with Javascript
« Reply #5 on: July 15, 2021, 05:24:27 PM »

Hello All I am new to this Forum and new to BlueBeam. First of All, excuse my language, but, what the FUUCCC**** are those question when signing up? where is the Crysler Building? what is the company who makes Revu? what is 3+2+9-5-6 ?!!! is this a Mensa Website that you have prove you are not retarded to even login?!!!!
No all anger aside, I need everybody's expertise. I am moving from Adobe to Bluebeam and I have too many questions. If somebody help me out be out of this stupidity box that would be great, thanks
1. In Adobe when I wanted to move one page from a file to another, the method was to simply drug and drop the page. I don't see this option to work in Bluebeam. right click, copy, right click paste is the only what I see in Bluebeam.
2. When creating a form I was trying to add a button and I wanted to modify the button to rename it to "Click here" and then configure it the way that you have you click it. I could somehow modify it and renamed the button. but was nowhere to be able to save the changes I make. I mean when I want to change the Trigger from "mouse up" to "mouse enter" I can do it but there is no click to save the changes!. I click away and it turns back to "mouse Up"! how to apply the changes?
Logged