d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Autofill Forms
Add Reply New Topic New Poll
Member
Posts: 17,606
Joined: Apr 19 2009
Gold: 1,917.10
May 8 2018 09:22am
I want to create multiple forms such as an invoice, document etc where all I need to do is enter a few details such a client name, organisation etc hit 'fill' or 'submit' and it will populate and generate the documents from templates with the necessary information input into the template from the initial form.

What is the best way to do this? Not looking for it to be done for me just need to know what to search for or a link to a video or guide.

Member
Posts: 4,905
Joined: Feb 19 2012
Gold: 0.00
May 8 2018 10:09am
Using SQL you could save the pertinent information into columns and then use a SELECT statement to pull the data on button press.

So like..
.
clientInformation (Table name)

clientName = "Bobby Joe" (Column 1)
clientCompany = "Amazon" (Column 2)
clientAddress = "102 Bobby Way" (Column 3)
clientPhone = "000-111-2222" (Column 4)
clientEmail = "BobbyJoe@amazon.com" (Column 5)

ect. ect.

And then when you type in say "Bobby Joe" into a box and hit "fill"

it issues a command like this;

SELECT * FROM clientInformation WHERE clientName = "Bobby Joe"

And then it would populate all your needed fields.

I use Visual Studio / VB.NET so if you go that route LMK if you ever need anything :)

Good luck in your projecy!


This post was edited by Damein on May 8 2018 10:10am
Member
Posts: 12,491
Joined: May 5 2013
Gold: 393.01
Warn: 10%
May 8 2018 12:12pm
SQL definitely works well for this, just be careful about how you architect it. With regards to the post above me, all it takes to destroy his system is for someone to enter something nasty in the search field i.e

Bobby Joe'; Drop table clientinformation;



Just don't forget SQL injection is a thing
Member
Posts: 4,905
Joined: Feb 19 2012
Gold: 0.00
May 8 2018 02:32pm
Quote (urkel182 @ May 8 2018 12:12pm)
SQL definitely works well for this, just be careful about how you architect it. With regards to the post above me, all it takes to destroy his system is for someone to enter something nasty in the search field i.e

Bobby Joe'; Drop table clientinformation;



Just don't forget SQL injection is a thing


True there are some precautions you must take :D was just giving him a starting point.

In regards to that, you could always put all customer names in a dropdown box that cannot be altered. Many ways to skin that cat, but yeah :D
Member
Posts: 17,606
Joined: Apr 19 2009
Gold: 1,917.10
May 8 2018 05:42pm
Thanks I will try this and see if it does what I need. It can be used to fill a word document or does the template need to be another format
Member
Posts: 4,905
Joined: Feb 19 2012
Gold: 0.00
May 8 2018 07:39pm
Well, IMO the easiest way would be to write the whole thing in something like Visual Studio or something. Just create the window in a layout like you would want a word document. But there are ways to interact with other windows, including some pretty good stuff to manipulate Office stuff.
Member
Posts: 17,606
Joined: Apr 19 2009
Gold: 1,917.10
May 10 2018 08:11am
I did it through Microsoft word bookmarks and visual basic. Pretty much exactly what I was after.

Only thing is one task is 3 documents and now I'll have to enter same info into each document. Only an extra 30 seconds or so per document but would be great to be as efficient as possible.

Might be able to put all into one document then when printing to PDF only print pages a to b and c to d etc.

Think the next few documents I prepare are bit more complicated do will push me to learn more about visual basic.

Go Back To Programming & Development Topic List
Add Reply New Topic New Poll