Help with a Calculation Script
I'm not sure if this is possible or not, but I have two checkboxe options on a form. When an item is checked, I want the total form to update, but I can't get it to work.
So CalcLine1 is a checkbox with an on value of $825.12
and CalcLine2 is a checkbox with an on value of $20
As the boxes are checked, I want the numeric field CalcTotal to update. I have it set with a Value Type of Calculated-Read only, but don't know where to go next.
Hi,
I am a new user and need to do some simple calculations, preferably without creating script. I have a series of check boxes which I want to equal "1" when checked. I need them to subtotal and then total.
I am using LiveCycle 8.0. There is no database behind this form although that would be a possible future enhancement.
Also - is there a good resource for understanding the basic manipulation of forms - answering questions like - What is a sub form? Can I insert a field in the middle of the form and have everything move down? Everything I have found deals with a more complex level of form creation, yet the help screens don't give enough of the underlying concepts. Thanks!
Similar Messages
-
Help with Custom calculation script in Acrobat 8
Hi all, I am using acrobat 8 on OS 10.5
I am trying to add certain fields (numbers) and then subtract another field value to give an end result.
I don't know anything about Javascript, would anyone be able to help with any info on how I achieve this result? I can only see Add, x and average etc... nothing there for subtraction
Thanks for any help in advance
SwenThis should get you started:
>if (event) {
// get values from two text fields
var a = Number(this.getField('Text1').value);
var b = Number(this.getField('Text2').value);
// subtract the values and show it
this.event.target.value = a - b;
Place this in a 3d text field, as a Custom Calculation Script. -
Need Help With Custom Calculation Script
Hey everyone. I'm using Acrobat Pro X and stumbling a bit on the syntax for the following equation. I need to add the value of "Cell1" & "Cell2" then add the value of "Cell3". However,the value of "Cell3" is entered by the user and specifies a percentage of the sum of "Cell1 & "Cell2". For example: If the user enters "3" into "Cell3" I need the returned value to be 3% of the sum of "Cell1" + "Cell2". If the user enters "9" into "Cell3" I need the returned value for "Cell3" to be 9% of the sum of "Cell1 & Cell2" and the end result needs to be the sum of "Cell1+Cell2+Cell3". In greater detail:
If "Cell1" = $500, "Cell2" = $500 and "Cell3" = "3" then I need the returned value to be $1030.00.
I hope this makes sense. Here's what I have so far but alas, it's not working. Any help would be GREATLY appreciated.
// Get first field value, as a number
var v1 = +getField("Cell1").value;
// Get second field value, as a number
var v2 = +getField("Cell2").value;
// Get processing field value, as a number
//var v3 = +getField("Cell3"/100).value;
// Calculate and set this field's value to the result
event.value = v3+(v1+v2);
Thanks,
SolanI posted an answer but realized it wasn't what you wanted. There is some confusion about what you want for Cell3. On the one hand, you say you want the user to enter a vaule in the field, but them you say you want its value to be calculated based on what the user enters and two other field values. It seems to me Cell3 should be the field that the user enters the percentage and the calculated field's (Cell4) script could then be:
// Get first field value, as a number
var v1 = +getField("Cell1").value;
// Get second field value, as a number
var v2 = +getField("Cell2").value;// Get processing field value, as a number
// Get the percentage
var v3 = +getField("Cell3").value;
// Calculate and set this field's value to the result
event.value = (1 + v3 / 100) * (v1 + v2); -
[solved]Need help with a bash script for MOC conky artwork.
I need some help with a bash script for displaying artwork from MOC.
Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
mocp -Q %file
gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last '/'?)
A point in the right direction would be appreciated.
thanks, d
Last edited by dgz (2013-08-29 21:24:28)Xyne wrote:
You should also quote the variables and output in double quotes to make the code robust, e.g.
filename="$(mocp -Q %file)"
dirname="${filename%/*}"
cp "$dirname"/front.jpg ~/backup/art.jpg
Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
thanks for the tip.
here it is, anyhow:
#!/bin/bash
filename=$(mocp -Q %file)
dirname=${filename%/*}
cp ${dirname}/front.jpg ~/backup/art.jpg
then in conky:
$alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
thanks for the help.
Last edited by dgz (2013-08-29 21:26:32) -
Need Assistance With Custom Calculation Script
I need help with a custom calculation script in Acrobat Pro. I am trying to add the sum of fields A, B, C, D, E, F, and G together with the lesser value of fields H and I. What would be the script to enter for this result? Thank you.
event.value = Number(this.getField("A").value) + Number(this.getField("B").value) + Number(this.getField("C").value) + Number(this.getField("D").value) + Number(this.getField("E").value) + Number(this.getField("F").value) + Number(this.getField("G").value) + Math.min(Number(this.getField("H").value), Number(this.getField("I").value));
-
Need help with form calculations
I'm converting a non-editable PDF form into an editable one and could use some help as I'm am new to this. Note: I did not create the non-editable form, It's a form I downloaded and use in my business.
I already figured out how to create text fields in the already created PDF non-editable form, now I'm trying to add in calculations. I can create the (value is the) calculations between 2 or more text fields, but now I need to multiply one text field by the number 3 and have the answer show up in another text field.
Example:
I'll use the letters A & B for the text filed names in my example.
I have text field A calculating the sum of other text fields using the (value is the sum of) option under the (calculate properties box.)
Now I want text field B to multiply text field A by a fixed number of 3. (A=24) x 3=72. I need text field B to have the answer of 72 in it.
I need text field B to always multiply text field A by 3.
Does anyone know how I can accomplish this?
I'm using Adobe 8 Pro.
Please note that I have no experiance using custom calculation script if that is the only way this will work and will step by step instruction on how to write the code.
Thank you very much.You can use the simplified field notation option. In this case, you'd enter:
3 * A
Where "A" the the exact name of the A field. It is best to avoid spaces and any other special characters for any fields that you'll want to include when using simplified field notation option. -
Hi, all, I am working on a form that was previously made in Excel. I wanted to remake this in an expandable pdf fillable so that I can add the accessibiltiy information to the form. The first link is to the static pdf converted from Excel here:
https://acrobat.com/#d=lIGyn*lpuWSQ-Qzkklml6w
The second link is the the form as my strained brain has recreated it. I'm sure there is probably a better method than I have chosen and I am open to all suggestions. But I can't get the table to total.
In the first table, all the calcs work correctly, ie 11, 12, 13, 14 and the total from 14 does show up in 15. but I need 17 to show the amount after the Discount (#16) is deducted. You would think something simple would do the trick, like SubTotal - Discount. That doesn't work.
Column 19 should total in the footer row next to 21. It doesn't. And column 23 should total into space #24. I have been trying for hours at a time to come up with the magic script to make this form work but......now I've decided to grovel for help.
https://acrobat.com/#d=mzovRUkKit7JnPVebPKgZwHi,
Here is your form back to you: https://acrobat.com/#d=a06D-SL7SK58ZulXCKNSuw. Please note that all of the scripts are FormCalc, as we are using the sum function and the wildcard. Neither of these will work in JavaScript.
Have a look at this post on how to reference objects, in particular the deomonstration of Control+Click:
http://www.assuredynamics.com/index.php/2011/05/som-expressions/
Also with buttons with linear gradient I would change the click behaviour from Inverted to Outline or None. It will be a little easier on the eyes. I have changed the two Add buttons. Also I think that you are getting in to readibility issues with the contrast between the button background and the black caption. I would recommend a read of this post, which outlines an approach to primary buttons (like the add rows) and secondary buttons (like the delete rows):
http://www.assuredynamics.com/index.php/2010/12/buttons/.
Maybe this discussion on colours:
http://www.assuredynamics.com/index.php/2011/02/any-colour-as-long-as-its-black/
Hope that helps,
Niall -
Help with query calculations (recursive)
Hi All,
I want some help with a query using a base rate and the result use in the next calculation year.
Here an example:
create table rate_type(
rate_type_id number,
rate_desc nvarchar2(50),
rate_base_year number
insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (1, 'Desc1', 4.6590);
insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (2, 'Desc2', 4.6590);
create table rates (
rate_type_id number
rate_year number,
rate_value number
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2012, 1.2);
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2013, 1.3);
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2014, 1.4);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2012, 1.2);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2013, 1.3);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2014, 1.4);The calculation for the first year should be the base rate of the rate type. The next year should use the result of the previous year and so on.
The result of my sample data is:
2012 = 4.659 + 1.2 + 4.659 * (1.2 * 0.01) = 5.9149
2013 = 5.9149 + 1.3 + 5.9149 * (1.3 * 0.01) = 7.1859
2014 = 7.1859 + 1.4 + 7.1859 * (1.4 * 0.01) = 8.4721Query result:
NAME 2012 2013 2014
Desc1 5.9149 7.1859 8.4721
Desc2 XXXX XXX XXXX
How can I do this in one select statement? Any ideas?
Thanks!Assuming you are on 11.2:
with t as (
select a.rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
count(*) over(partition by a.rate_type_id) cnt,
row_number() over(partition by a.rate_type_id order by rate_year) rn
from rate_type a,
rates b
where a.rate_type_id = b.rate_type_id
r(
rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
result
) as (
select rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
from t
where rn = 1
union all
select t.rate_type_id,
t.rate_desc,
t.rate_year,
t.rate_base_year,
t.rate_value,
t.cnt,
t.rn,
r.result + t.rate_value + r.result * t.rate_value * 0.01 result
from r,
t
where t.rate_type_id = r.rate_type_id
and t.rn = r.rn + 1
select *
from (
select rate_desc name,
rate_year,
result
from r
where rn <= cnt
pivot (sum(result) for rate_year in (2012,2013,2014))
order by name
NAME 2012 2013 2014
Desc1 5.914908 7.2918018 8.79388703
Desc2 5.914908 7.2918018 8.79388703
SQL> Obviously pivoting assumes you know rate_year values upfront. If not, then without pivoting:
with t as (
select a.rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
count(*) over(partition by a.rate_type_id) cnt,
row_number() over(partition by a.rate_type_id order by rate_year) rn
from rate_type a,
rates b
where a.rate_type_id = b.rate_type_id
r(
rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
result
) as (
select rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
from t
where rn = 1
union all
select t.rate_type_id,
t.rate_desc,
t.rate_year,
t.rate_base_year,
t.rate_value,
t.cnt,
t.rn,
r.result + t.rate_value + r.result * t.rate_value * 0.01 result
from r,
t
where t.rate_type_id = r.rate_type_id
and t.rn = r.rn + 1
select rate_desc name,
rate_year,
result
from r
where rn <= cnt
order by name,
rate_year
NAME RATE_YEAR RESULT
Desc1 2012 5.914908
Desc1 2013 7.2918018
Desc1 2014 8.79388703
Desc2 2012 5.914908
Desc2 2013 7.2918018
Desc2 2014 8.79388703
6 rows selected.
SQL> SY. -
I have a simple form on a web page for associaiton members to
order lapel pins. I want to provide a toal cost of the order but I
can't for the life of me get anything to multiply the value in a
text fiels by a constant number ($5.00). I found some Javascript on
the internet but I couldn't get it to function either. I am using
Dreamweaver 8 and cannot find any reference to simple math
calculations. Imust be overlooking something as something so simple
can't be that hard. Can someone provide me with some simple script
or method of doing this?>I have a simple form on a web page for associaiton
members to order lapel
>pins.
> I want to provide a toal cost of the order but I can't
for the life of me
> get
> anything to multiply the value in a text fiels by a
constant number
> ($5.00).
In ASP/VBSCRIPT:
<%
Dim varAmount
varAmount = Request.Form("HowMany") * 5
Response.Write FormatCurrency("varAmount")
%> -
Help with first Adobe Script for AE?
Hey,
I'm trying to create a script that will allow me to set a certain number of layer markers at an even interval to mark out a song. Could someone help me troubleshoot this script? I've been working on it for ages now, and I'm about to snap. I've basically gone from HTML and CSS, to javascript and Adobe scripting in the past few hours, and I cannot figure this out for the life of me.
I want to create a dialog with two fields, the number of markers to place, and the tempo of the song. Tempo is pretty simple, its just the number of beats per minute. The script is meant to start at a marker that I have already placed, and set a new marker at incrementing times. Its mainly to help me see what I'm trying to animate too, even if the beat is a little hard to pick up every once in a while.
Also, is there a better way to do this? This script will help me in the long run because I will need to do this pretty often, but I'm wondering if there was something that I could not find online that would have saved me these hours of brain-jumbling?
Thank you very much for any help you can offer.
// Neo_Add_MultiMarkers.jsx
//jasondrey13
//2009-10-26
//Adds multiple markers to the selected layer.
// This script prompts for a certain number of layer markers to add to the selected audio layer,
//and an optional "frames between" to set the number of frames that should be skipped before placing the next marker
// It presents a UI with two text entry areas: a Markers box for the
// number of markers to add and a Frames Between box for the number of frames to space between added markers.
// When the user clicks the Add Markers button,
// A button labeled "?" provides a brief explanation.
function Neo_Add_MultiMarkers(thisObj)
// set vars
var scriptName = "Neoarx: Add Multiple Markers";
var numberOfMarkers = "0";
var tempo = "0";
// This function is called when the Find All button is clicked.
// It changes which layers are selected by deselecting layers that are not text layers
// or do not contain the Find Text string. Only text layers containing the Find Text string
// will remain selected.
function onAddMarkers()
// Start an undo group. By using this with an endUndoGroup(), you
// allow users to undo the whole script with one undo operation.
app.beginUndoGroup("Add Multiple Markers");
// Get the active composition.
var activeItem = app.project.activeItem;
if (activeItem != null && (activeItem instanceof CompItem)){
// Check each selected layer in the active composition.
var activeComp = activeItem;
var layers = activeComp.selectedLayers;
var markers = layers.property("marker");
//parse ints
numberOfMarkers = parseInt (numberOfMarkers);
tempo = parseInt (tempo);
// Show a message and return if there is no value specified in the Markers box.
if (numberOfMarkers < 1 || tempo < 1) {
alert("Each box can take only positive values over 1. The selection was not changed.", scriptName);
return;
if (markers.numKeys < 1)
alert('Please set a marker where you would like me to begin.');
return;
var beginTime = markers.keyTime( 1 );
var count = 1;
var currentTime = beginTime;
var addPer = tempo/60;
while(numberOfMarkers < count)
markers.setValueAtTime(currentTime, MarkerValue(count));
currentTime = currentTime + addPer;
if (count==numberOfMarkers) {
alert('finished!');
return;
else{
count++;
app.endUndoGroup();
// Called when the Markers Text string is edited
function onMarkersStringChanged()
numberOfMarkers = this.text;
// Called when the Frames Text string is edited
function onFramesStringChanged()
tempo = this.text;
// Called when the "?" button is clicked
function onShowHelp()
alert(scriptName + ":\n" +
"This script displays a palette with controls for adding a given number of markers starting at a pre-placed marker, each separated by an amount of time determined from the inputted Beats Per Minute (Tempo).\n" +
"It is designed to mark out the even beat of a song for easier editing.\n" +
"\n" +
"Type the number of Markers you would like to add to the currently selected layer. Type the tempo of your song (beats per minute).\n" +
"\n" +
"Note: This version of the script requires After Effects CS3 or later. It can be used as a dockable panel by placing the script in a ScriptUI Panels subfolder of the Scripts folder, and then choosing this script from the Window menu.\n", scriptName);
// main:
if (parseFloat(app.version) < 8)
alert("This script requires After Effects CS3 or later.", scriptName);
return;
else
// Create and show a floating palette
var my_palette = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName, undefined, {resizeable:true});
if (my_palette != null)
var res =
"group { \
orientation:'column', alignment:['fill','fill'], alignChildren:['left','top'], spacing:5, margins:[0,0,0,0], \
markersRow: Group { \
alignment:['fill','top'], \
markersStr: StaticText { text:'Markers:', alignment:['left','center'] }, \
markersEditText: EditText { text:'0', characters:10, alignment:['fill','center'] }, \
FramesRow: Group { \
alignment:['fill','top'], \
FramesStr: StaticText { text:'Tempo:', alignment:['left','center'] }, \
FramesEditText: EditText { text:'140', characters:10, alignment:['fill','center'] }, \
cmds: Group { \
alignment:['fill','top'], \
addMarkersButton: Button { text:'Add Markers', alignment:['fill','center'] }, \
helpButton: Button { text:'?', alignment:['right','center'], preferredSize:[25,20] }, \
my_palette.margins = [10,10,10,10];
my_palette.grp = my_palette.add(res);
// Workaround to ensure the editext text color is black, even at darker UI brightness levels
var winGfx = my_palette.graphics;
var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);
my_palette.grp.markersRow.markersEditText.graphics.foregroundColor = darkColorBrush;
my_palette.grp.FramesRow.FramesEditText.graphics.foregroundColor = darkColorBrush;
my_palette.grp.markersRow.markersStr.preferredSize.width = my_palette.grp.FramesRow.FramesStr.preferredSize.width;
my_palette.grp.markersRow.markersEditText.onChange = my_palette.grp.markersRow.markersEditText.onChanging = onMarkersStringChanged;
my_palette.grp.FramesRow.FramesEditText.onChange = my_palette.grp.FramesRow.FramesEditText.onChanging = onFramesStringChanged;
my_palette.grp.cmds.addMarkersButton.onClick = onAddMarkers;
my_palette.grp.cmds.helpButton.onClick = onShowHelp;
my_palette.layout.layout(true);
my_palette.layout.resize();
my_palette.onResizing = my_palette.onResize = function () {this.layout.resize();}
if (my_palette instanceof Window) {
my_palette.center();
my_palette.show();
} else {
my_palette.layout.layout(true);
else {
alert("Could not open the user interface.", scriptName);
Neo_Add_MultiMarkers(this);You should ask such questions over at AEnhancers. I had a quick look at your code but could not find anything obvious, so it may relate to where and when you execute certain functions and how they are nested, I just don't have the time to do a deeper study.
Mylenium -
URGENT Help With Scientific Calculator!
Hi everybody,
I designed a calculator, and I need help with the rest of the actions. I know I need to use the different Math methods, but I tried tried that and it didn't work. Also, it needs to work as an applet and application, and in the applet, the buttons don't appear in order, how can I fix that?
I will really appreciate your help with this program, I can't get it to work and I'm frustrated, I need to finish this for next Tuesday 16th. Please e-mail me at [email protected].
Below is the code for the calcualtor.
Thanks a lot!
-Maria
// calculator
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class calculator extends JApplet implements
ActionListener
private JButton one, two, three, four, five, six, seven,
eight, nine, zero, dec, eq, plus, minus, mult, div, clear,
mem, mrc, sin, cos, tan, asin, acos, atan, x2, sqrt, exp, pi, percent;
private JLabel output, blank;
private Container container;
private String operation;
private double number1, number2, result;
private boolean clear = false;
//GUI
public void init()
container = getContentPane();
//Title
//super("Calculator");
JPanel container = new JPanel();
container.setLayout( new FlowLayout( FlowLayout.CENTER
output = new JLabel("");
output.setBorder(new MatteBorder(2,2,2,2,Color.gray));
output.setPreferredSize(new Dimension(1,26));
getContentPane().setBackground(Color.white);
getContentPane().add( "North",output );
getContentPane().add( "Center",container );
//blank
blank = new JLabel( " " );
container.add( blank );
//clear
clear = new JButton( "CE" );
clear.addActionListener(this);
container.add( clear );
//seven
seven = new JButton( "7" );
seven.addActionListener(this);
container.add( seven );
//eight
eight = new JButton( "8" );
eight.addActionListener(this);
container.add( eight );
//nine
nine = new JButton( "9" );
nine.addActionListener(this);
container.add( nine );
//div
div = new JButton( "/" );
div.addActionListener(this);
container.add( div );
//four
four = new JButton( "4" );
four.addActionListener(this);
container.add( four );
//five
five = new JButton( "5" );
five.addActionListener(this);
container.add( five );
//six
six = new JButton( "6" );
six.addActionListener(this);
container.add( six );
//mult
mult = new JButton( "*" );
mult.addActionListener(this);
container.add( mult );
//one
one = new JButton( "1" );
one.addActionListener(this);
container.add( one );
//two
two = new JButton( "2" );
two.addActionListener(this);
container.add( two );
//three
three = new JButton( "3" );
three.addActionListener(this);
container.add( three );
//minus
minus = new JButton( "-" );
minus.addActionListener(this);
container.add( minus );
//zero
zero = new JButton( "0" );
zero.addActionListener(this);
container.add( zero );
//dec
dec = new JButton( "." );
dec.addActionListener(this);
container.add( dec );
//plus
plus = new JButton( "+" );
plus.addActionListener(this);
container.add( plus );
//mem
mem = new JButton( "MEM" );
mem.addActionListener(this);
container.add( mem );
//mrc
mrc = new JButton( "MRC" );
mrc.addActionListener(this);
container.add( mrc );
//sin
sin = new JButton( "SIN" );
sin.addActionListener(this);
container.add( sin );
//cos
cos = new JButton( "COS" );
cos.addActionListener(this);
container.add( cos );
//tan
tan = new JButton( "TAN" );
tan.addActionListener(this);
container.add( tan );
//asin
asin = new JButton( "ASIN" );
asin.addActionListener(this);
container.add( asin );
//acos
acos = new JButton( "ACOS" );
cos.addActionListener(this);
container.add( cos );
//atan
atan = new JButton( "ATAN" );
atan.addActionListener(this);
container.add( atan );
//x2
x2 = new JButton( "X2" );
x2.addActionListener(this);
container.add( x2 );
//sqrt
sqrt = new JButton( "SQRT" );
sqrt.addActionListener(this);
container.add( sqrt );
//exp
exp = new JButton( "EXP" );
exp.addActionListener(this);
container.add( exp );
//pi
pi = new JButton( "PI" );
pi.addActionListener(this);
container.add( pi );
//percent
percent = new JButton( "%" );
percent.addActionListener(this);
container.add( percent );
//eq
eq = new JButton( "=" );
eq.addActionListener(this);
container.add( eq );
//Set size and visible
setSize( 190, 285 );
setVisible( true );
public static void main(String args[]){
//execute applet as application
//applet's window
JFrame applicationWindow = new JFrame("calculator");
applicationWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//applet instance
calculator appletObject = new calculator();
//init and start methods
appletObject.init();
appletObject.start();
} // end main
public void actionPerformed(ActionEvent ae)
JButton but = ( JButton )ae.getSource();
//dec action
if( but.getText() == "." )
//if dec is pressed, first check to make shure there
is not already a decimal
String temp = output.getText();
if( temp.indexOf( '.' ) == -1 )
output.setText( output.getText() + but.getText() );
//clear action
else if( but.getText() == "CE" )
output.setText( "" );
operation = "";
number1 = 0.0;
number2 = 0.0;
//plus action
else if( but.getText() == "+" )
operation = "+";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//minus action
else if( but.getText() == "-" )
operation = "-";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//mult action
else if( but.getText() == "*" )
operation = "*";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//div action
else if( but.getText() == "/" )
operation = "/";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//eq action
else if( but.getText() == "=" )
number2 = Double.parseDouble( output.getText() );
if( operation == "+" )
result = number1 + number2;
else if( operation == "-" )
result = number1 - number2;
else if( operation == "*" )
result = number1 * number2;
else if( operation == "/" )
result = number1 / number2;
//output result
output.setText( String.valueOf( result ) );
clear = true;
operation = "";
//default action
else
if( clear == true )
output.setText( "" );
clear = false;
output.setText( output.getText() + but.getText() );
}Multiple post:
http://forum.java.sun.com/thread.jsp?forum=31&thread=474370&tstart=0&trange=30 -
Help with web form script. PHP, CGI, Perl???
anyone willing to help with a web form script? I have a form built, but cant seem to figure out the scripting! Should I be using Perl, CGI, PHP... What do I need to enable? I am a complete novice when it comes to scripts. Looking for a little friendly help.
Here is a simple bit of PHP to stick in the page your form posts to. You would need to edit the first three variables to your liking, and add the html you want to serve afterwards:
<pre>
<?php
$emailFrom = '[email protected]';
$emailTo = '[email protected]';
$emailSubject = 'Subject';
$date = date('l, \t\h\e dS \o\f F, Y \a\t g:i A');
$browser = $HTTPSERVER_VARS['HTTP_USERAGENT'];
$hostname = $HTTPSERVER_VARS['REMOTEADDR'];
$message = "$date\n\nAddress: $hostname\nBrowser: $browser\n\n";
foreach ($_POST as $key => $value) {
$message .= $key . ": " . $value . "\n";
$mailResult = mail($emailTo,$emailSubject,$message,"From: $emailFrom");
?>
</pre>
This script will grab the server's date and the submitter's address and browser type. It will then list the name and value of each form field you have put on your form.
Also, this script expects your form method="post".
Lastly, you can offer alternate text later on in your html page based on the success of the above script with a snippet like this:
<pre><?php
if ($mailResult) {
echo "Your comments have been received thank you.";
} else {
echo "There was an error. Please try again or contact us using an alternate method.";
?></pre> -
I have an existing pdf that i am trying to edit and make it more functional...i.e. fillable info with auto calculations of cost based on a given number (times a specific cost)
Example on the form....
Car Registrations (per car) _____ X $25 _________
The first line above is # Cars Registered
The last line is Total Cost
The blank lines above i have added a text box to for auto calculations. I have formated these boxes as numbers (first line) and dollar value total (second line)
I've added another text box for the $25 and placed it overtop the worded one. I've locked this box and the total box. I've calculated the product of the total box by linking it to the first line and the $25 to give the total cost...
Problem is, it isnt working....the total box isn't seeing the $25 to give a proper calc. Whatever number i place in the first line, only zero shows in the total.
I'm obviously missing something....been at this for two days....frustrated. I have many more inputs like this on the form, and eventually want all the totals to provide sub totals and a grand total. I understand how this all works to a degree, doesnt seem that difficult, but i have to be missing something.
I even tried re-creating the document in word, input to adobe, make a new form, let the system recoginize areas as fillable, etc, etc, etc. When i get to the calculations portion, same result...there are not many tutorials out there on this...sadly
Woking on a MAC...
I have acrobat X Progr8snkbite wrote:
I have an existing pdf that i am trying to edit and make it more functional...i.e. fillable info with auto calculations of cost based on a given number (times a specific cost)
Example on the form....
Car Registrations (per car) _____ X $25 _________
The first line above is # Cars Registered
The last line is Total Cost
The blank lines above i have added a text box to for auto calculations. I have formated these boxes as numbers (first line) and dollar value total (second line)
I've added another text box for the $25 and placed it overtop the worded one. I've locked this box and the total box. I've calculated the product of the total box by linking it to the first line and the $25 to give the total cost...
Problem is, it isnt working....the total box isn't seeing the $25 to give a proper calc. Whatever number i place in the first line, only zero shows in the total.
I'm obviously missing something....been at this for two days....frustrated. I have many more inputs like this on the form, and eventually want all the totals to provide sub totals and a grand total. I understand how this all works to a degree, doesnt seem that difficult, but i have to be missing something.
I even tried re-creating the document in word, input to adobe, make a new form, let the system recoginize areas as fillable, etc, etc, etc. When i get to the calculations portion, same result...there are not many tutorials out there on this...sadly
Woking on a MAC...
I have acrobat X Pro
I created your sample.
name the field after Number of cars, as car
The calulation field named total -
Help with Javascript/Calculations
Hello,
Have a building use policy for school.
Need help with checkboxes and default values. I can get javascript/math to work when I click check box.
Someone wants to rent a room they check the rentRoom checkbox. Then the enter how many rooms 1,2,3 etc.. The value for the rentRoom checkbox is $25.
I can get it when the checkbox for rentRoom is selected the rentRoom.Total computes correctly. However, what I want is when the form opens up a default value of $0.00 to be in there. I also want if someone goes back and unchecks the rentRoom checkbox the value goes back to $0.00 not just blank. Right now I am getting the error the value entered does not match the value of the field. That is if I put the default value in options. Basically, I can't seem to figure out the javascript code to get this to work.
Am I asking for too much, can someone guide me to javascript to help me out.
I have tried if/then statements and switch statements. I just can't figure out how to get it to for lack of better a word - toggle back and forth.
If this is not possible please tell me. If it is too complicated tell me. I am not using livecycle for this as we had a word document and I just used the find form fields. I am also using Adobe Acrobat 8 Professional.
ThanksHello,
Thanks that looks good. I am still missing something but the calc doesn't work when I put in my variables. I will work with it more but nothing happens.
The one thing is I have the default value of the checkbox as 15 so don't know if that messes it up.
Right now I get the default value of $0.00 all the time. When I click on the check box on/off it doesn't do the calcs.
sorry, any more input, what am i missing??
I also changed the syntax error that was posted on your origianl post. You had == 'Off" I changed that to 'Off' -
Help with a startup script for monitorix
How can I deal with a perl script that doesn't acknowledge a query for pidof?
$ ps aux | grep monitorix
root 1089 0.0 1.2 16280 6556 ? Ss 09:54 0:00 /usr/bin/monitorix -c /etc/monitorix.conf
So it's running... but I can't find it with pidof:
$ pidof /usr/bin/monitorix
Here is the /etc/rc.d/monitorix I've been using but that doesn't stop the program (since it has no PID).
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
PID=`pidof -o %PPID /usr/bin/monitorix`
MARGS="-c /etc/monitorix.conf"
case "$1" in
start)
stat_busy "Starting Monitorix"
if [ -z "$PID" ]; then
/usr/bin/monitorix $MARGS
fi
if [ ! -z "$PID" -o $? -gt 0 ]; then
stat_fail
else
PID=`pidof -o %PPID /usr/bin/monitorix`
echo $PID > /var/run/monitorix.pid
add_daemon monitorix
stat_done
fi
stop)
stat_busy "Stopping Monitorix"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon monitorix
else
rm_daemon monitorix
stat_done
fi
restart)
$0 stop
sleep 1
$0 start
echo "usage: $0 {start|stop|restart}"
esacAccording to the man page, the -p flag will let you generate a PID file.
You have a few logical errors in your rc.d script and a syntax error (double else in stop). I've been using a template similar to the below in cleaning up a few of the packages I maintain...
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
pidfile=/run/monitorix.pid
if [[ -r $pidfile ]]; then
read -r PID < "$pidfile"
if [[ ! -d /proc/$PID ]]; then
# stale pidfile
unset PID
rm -f "$pidfile"
fi
fi
args=(-c /etc/monitorix.conf -p "$pidfile")
case "$1" in
start)
stat_busy "Starting Monitorix"
if [[ -z $PID ]] && /usr/bin/monitorix "${args[@]}"; then
add_daemon monitorix
stat_done
else
stat_fail
exit 1
fi
stop)
stat_busy "Stopping Monitorix"
if [[ $PID ]] && kill $PID &> /dev/null; then
rm_daemon monitorix
stat_done
else
stat_fail
exit 1
fi
restart)
$0 stop
sleep 1
$0 start
echo "usage: $0 {start|stop|restart}"
esac
please also fix the PKGBUILD:
install=('readme.install')
This is not valid, and pacman 4 will not let you declare install as an array.
Last edited by falconindy (2011-09-25 15:05:02)
Maybe you are looking for
-
IOS 7.1.2 screwed up
Folks, While updating iOS 7.1.2 on my iPhone 5, the phone got hanged almost midway. Has been like that for last 10 hours or so... Can not even reboot fix it or hard-reset it as the power button doesn't work due to a manufacturing defect. Can somebody
-
File --- to--- Soap(web service)
Hi all, i am doing File ->to->Soap(web service) scenario. my requiremenmt would be 1.Can we able to re-trigger failed & successful messages 2.Can we we able send the consolidated XML for the day irrespective of individual xml's 3.we able to send the
-
I have tried it out for so many times, but still cannot solve the problems, anyone pls help me out on this.... <%@page import="javax.servlet.*,javax.servlet.http.*,java.util.*,java.sql.*,java.io.*,java.text.*,javax.swing.*"%> <jsp:useBean id="singleS
-
I am unable to login in to use FaceTime. After signing in to my apple account, I get the error message " The server encountered an error processing registration. Please try again later."
-
Disk will NOT eject nor be recognized. HELP ME!
My MacBook Pro did NOT recognize this disk & it will NOT eject it. What do I do? Please help me, thanks.