Copy link to clipboard
Copied
I am making a pdf form in which user has to enter the time in minutes (:00 format ex - 00:20 means 20 minutes) and after they have entered all the fields it has to be added up in total field . the form is something like this
00:20 this mean 20 minutes
00:10 this means 10 minutes
00:05 this means 5 minutes
00:02 this means 2 minutes
00:50 this means 50 mintes
00:59 this means 59 ,minutes
00:146 the total should be 146 minutes and should in the format :00000 i.e total field should show 00:146 meaning 146 minutes and if total comes 10000 minutes it should as 00:10000
Please if anyone can help me to get this via pdf javascripting.
thanks in advance.
You can use this code as the custom Format script:
if (event.value!="") event.value = "00:"+event.value;
Copy link to clipboard
Copied
What's the point of the "00:" part, then? If you just want to have minutes then you should just enter it as a pure number.
If you use the "00:00" format then the left part should be used for hours and the right part for minutes. So 146 minutes should be entered (or at least displayed) as: "02:26", not as "00:146"...
Copy link to clipboard
Copied
Sir,
But client want to display it as minutes 00:146 (146 minutes) in the total column not in hours and minutes.
I want that only that one should enter a pure number but it should display in 00:00 format ( if 15 is entered it should show display as 00:15 meaning it is 15 minutes) and then all should add in the total field display as 00:146.
Plz give me javascript for the above problem.
Copy link to clipboard
Copied
I would just use a custom Format script to add the "00:" part, then.
Copy link to clipboard
Copied
wat is javascript for that.. bcoz i a novice in these things.
Copy link to clipboard
Copied
You can use this code as the custom Format script:
if (event.value!="") event.value = "00:"+event.value;
Copy link to clipboard
Copied
Thank you for the help
i am stuck in one more problem.. if you could help me...
I have 28 fields in which numbers would be entered and in the 29th field the maximum among the 28 numbers should be shown.
plz help me with the exact javascript.....
Thanking you
Copy link to clipboard
Copied
For that you can use the Math.max() method. See: JavaScript max() Method
Copy link to clipboard
Copied
but how to use them in the numbers are entered in the field as they are variables, and while calculating the greatest number it should leave the empty fields.
Copy link to clipboard
Copied
I want javascript to be used in pdf form as Math.max() method is not working ...
plz provide me with the full pdf javascript to find the greatest number among the given numbers excluding the empty fields.
Thanking you
Copy link to clipboard
Copied
Sir,
Your Math.max() method didnot worked , i am asking for pdf form javascripting, well i got something for pdf forms but this is not working.... since you are an expert, could you plz help me with the following script and edit the below script so that this works. My purpose is to find the greatest number among the 28 numbers populated by user my text field is name as DP.1, DP.2 ........ DP.28
// custom calculation script for "Min"
var minValid = false;
var min = 0;
for (var i=0; i>=4; i++)
{
var val = parseInt(this.getField("DP." + i).value);
if (!isNaN(val)) // we have a valid number
{ if (minValid == true)
{ // this is the first valid value
min = val;
minValid = false;
}
else
{
min = Math.min(min, val);
}
}
}
if (minValid)
event.value = min;
else
event.value = "";
Copy link to clipboard
Copied
It will work if used correctly. If you want me to write the code for you contact me privately and we can discuss it further.
Copy link to clipboard
Copied
how to contact you..... i don't have your contact details
Copy link to clipboard
Copied
hover your mouse over the user name
you may then click the Message option in the popup window to send a private email
DO NOT ASK FOR A SKYPE ADDRESS OR YOU WILL BE MARKED AS A SPAMMER
Copy link to clipboard
Copied
sorry sir, i am new to this .. thatswhy i didnot knew about the policy of the forum... i will take care of it in future
Find more inspiration, events, and resources on the new Adobe Community
Explore Now