Copy link to clipboard
Copied
I need help plz on how to create a requisition field that generate numbers in sequence
I have tried to use this code below but wont' work
this.getField("ID").value = ((+this.getField("ID").value) + 1);
to provide more info:
I created a text and called it Request, then I pasted the following code in JavaScript editor of that Request field
this.getField("ID").value = ((+this.getField("ID").value) + 1);
I have replaced the above word "ID" to "Request"
then I saved it and closed the form, but when I tried to re lunch it I don't get to see any number being generated in sequence in the Request field.
Please note that I have no numbers in the value tab of the request field.
Copy link to clipboard
Copied
This code should be placed as a doc-level script, under Tools - JavaScript - Document JavaScripts, not under the field itself.
Copy link to clipboard
Copied
Joe Nasralla 19-Apr-2018 8:42 AM (in response to try67)
HI Try67
I been working on this since 2 weeks today
I am trying to create a pdf that should generate a unique requisition number
only after the user hit the submit button.
For example: User A filled the PDF form, then he hit submit button.
then the form will be sent to 3 managers, if any of the 3 managers opens
the pdf file they should see a requisition number generated automatically.
Does that makes any sense?
Copy link to clipboard
Copied
I don't see that this idea can work, because the user would need to save the form TO THE SAME PLACE as well as submit. If they don't save the form, the next invoice will have the same number.
Copy link to clipboard
Copied
okay can anyone help me plz figure this out
what is the best way of having users filling a pdf request form then to be sent to us with a request#?
so far this is the only code I have but it doesn't work proper because it only generate a request# in sequence if I hit the mouse on the request field once and then outside the request field once. In other words it won't generate the request# if the user save it.
this.getField("Request").value = ((+this.getField("Request").value) + 1);
Copy link to clipboard
Copied
All I am trying to do is:
I need employee to fill the pdf request form
then save it then somehow generate a request or requisition number
then when they submit it goes to 3 managers
then when the managers open the pdf files they should see a request number generated in sequence.
=====
so far I managed to get the pdf to generate a request # in order, but it only works if I hit on the actual request field once and then hit another click outside the request field then it only generate the request number in sequence.
I hope that I makes sense
Copy link to clipboard
Copied
You need to do all of this in a single script, under the Submit button.
It should:
- Increment the value of the req. number by one.
- Prompt the user to save the file.
- If the file is not saved (ie, it's dirty) show an error message and quit.
- If it is saved, submit it.
Copy link to clipboard
Copied
okay so far I have a request field on the top of the forum and submit button at the bottom of the form that only send the form to the managers.
so I have the following code for the REQUEST button at the top of the forum " this.getField("Request").value = ((+this.getField("Request").value) + 1); "
I have no clue how to write the code for the submit button as you mentioned plz help
-Increment the value of the req. number by one.
- Prompt the user to save the file.
- If the file is not saved (ie, it's dirty) show an error message and quit.
- If it is saved, submit it.
Copy link to clipboard
Copied
It's a big "somehow". This is normally done in a web script or shared app, using a database. PDF only _seems_ an easy way.
Copy link to clipboard
Copied
This is what I have done so far
1-As Try67 said to put all the codes in the submit button
2- so now when user A open the pdf file from a shared location, he can fill it and once he hit the submit button it does generate a request number in sequence as well it does send an email to the manager.
3- issue I am having at this moment is: when User B open the same file from the same shared location, he can sees all the information that was filled by user A.
4- What I need to do is after user A open and fill and submit the form, I need JavaScript code to clear all fields except the request field. because if the request field got deleted as well it will generate the same invoice # which is # 1 same invoice user A generated.
Copy link to clipboard
Copied
In other wording can anyone help me on how to reset all fields in the form except the request field?
Copy link to clipboard
Copied
There's no need for that. Simply set the field's defaultValue and then the reset command won't change it.
Copy link to clipboard
Copied
Great I now managed to do the following:
1-All users can open the form from a shared location
2-Once User A open the form he will see a request number showing with a number and the rest of the fields are empty.
3-Once user A fill all the fields, he can then hit the submit button and it will be emails to the managers with the current request number.
4-Problem is when user B open the same PDF file from the same shared folder he can see User A inputs instead of being a blank form.
So issue is: User B should not see any inputs once he open the form within the shared folder.
any clue plzzzzz it seems that I am almost there
Copy link to clipboard
Copied
I now managed to do the following:
-If user A opened the request form from a shared drive, he can fill it and submit and email it to the manager
issue is: after email the form to the manager, the pdf file prompt the user if he wants to save it or not.
if the user choose to save it, then it's great everything works the way it should be
However if user A chooses not to save it, this will cause an issue for User B
If User B wants to open the same form from the same location, he will be using the same previous request # that User A used.
so what I need help to do is this:
I need the pdf form to run java script code to auto save and exit after the submit button is submitted ?
Copy link to clipboard
Copied
So I see that this is an old posting that I have found. I am trying to do the same thing you have done. After reading through all of the posts here, has this worked for you? If it has, can you help me navigate through it to do the same think please.
Thank you, Ken