These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Having problems with my form(With filter and updating)

rroan13
Registered: Apr 15 2010
Posts: 5

See, i made a form, which, you can fill up your name, age , nationality etc. It also updates, delete records using formcalc script "xfa.host.MyDataconnection.update()" etc. and yeah, it is working, so i add another feature to the form, where it filters the name using data drop down list. So now, i have 2 fields that is bound in one column, specifically "Name". the first one is binded in the data drop down list and the second one is, binded in the Name textbox. After that, i can fill up entries on every textbox, but whenever i update it, it says something about "duplicate data". And my Name in the Access Database is also set to Primary key. So what i did was remove the primary key on the name column, and then start testing the form again. so, it works, yeepeee, BUT, it duplicates every update i made, well, what i want is, whenever i made a record about one name. and whenever i like to update its other columns for example, i have a typo in his nationality, i only want it to update not to make another record of it. can you please help with this, :(.

Regards,

rroan13

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
First, as you've found, you should not bind any field to the primary key. Next, when updating data, only one field should be bound to each DB column. If the data is needed in multiple places it can be copied with a script. It sounds like you are filling the drop down using dynamic binding? is this correct? A better approach is to write a loop that fills the entries in the dropdown, so it is not bound to a field that will need to be updated.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

rroan13
Registered: Apr 15 2010
Posts: 5
Hmmm, ive already trid it, but what happen is, if i try to update an old record, the record itself isnt overwritten, what happens is it just made a new record of it. so the result, there will be two records with the same info, the only difference is, the update that you made. for example, ive search from the dropdown the Name "rroan" and i changed it to "rroans", after clicking update, it will save the changes, but it will not overwrite the old record, it will make another record same as the old one but this time, with the changes that you have made. Please help me
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You stated in your first post that Update was working before you added the drop down feature. Does removing the dropdown feature restore the operation of Update?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

rroan13
Registered: Apr 15 2010
Posts: 5
Yes it does, it does update properly without the drop down list. but, i need something, any fields, whether its drop down or textbox for searching the Names of the clients for updating purposes. For example, i have a Table with 3 columns, named Names, Age, Location. So, I already have 3 datas, for example, the first row has Arron as Name, 21 as Age, Dubau as Location. Second row has Adrian as Name, 19 as Age, US as Location, and third row has Javal as Name, 25 as Age, Philippines as Location. I need something to search through the record, so for example, i will edit the Location of Arron, and when i update it, it will not duplicate the records, hence, it will only append the same records that is currently displayed. Please help me sir :(.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can easily search the records and fill a drop list without any binding. The "xfa.record" model contains all the current record data.

Write code to walk the records, in the loop grab the name column value and insert it as an item in a drop list that has no binding. You can use a similar technique to navigate the DB to the correct record when the user selects a value. I've got video tutorials and samples that use exactly this technique at www.pdfscripting.com. This is a membership site. So they are only availible if you sign up.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

rroan13
Registered: Apr 15 2010
Posts: 5
Ok, thanks thomps, I'll try to view the link and come back here if i have further questions. Thanks