473,386 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Check All Box with on a Adobe 8.0 pdf form

kcdoell
230 100+
Hello:

I am a newbie with Java coding... I have a form that I created in Word. Within that form it had a place where the user could selected certain states or all states via a checkbox. I used VBA coding to do this and it works great. My problem is now I have to convert the form to an Adobe 8.0 pdf form. The conversion process does not bring over the VBA logic. So I placed the check boxes for each state and then inserted an object (button) for selecting all the State check boxes if it was applicable:

I used the following code that I believed would work but nothing happens on execution:

My Checkboxes were named the following (I have 50 of these checkboxes):

SS.1
SS.2
SS.3
SS.4
SS.5

Then I thought the code would be inserted in my button object:

Expand|Select|Wrap|Line Numbers
  1. var s="";
  2. for(var i=1;i<51;i++){
  3.     s="SS."+i;
  4.     getField(s).value="Yes"
  5. }
  6.  
______________

Does that make sense to those who understand the inner workings of Java?

Any ideas would be helpful.

Thanks,
Feb 4 '08 #1
27 5833
BigDaddyLH
1,216 Expert 1GB
How did you manage to inject Java into a PDF?
Feb 4 '08 #2
kcdoell
230 100+
Using the Adobe LiveCycle Designer that comes with the Adobe 8.0 Professional version
Feb 4 '08 #3
BigDaddyLH
1,216 Expert 1GB
Using the Adobe LiveCycle Designer that comes with the Adobe 8.0 Professional version
Are you sure you know what language you're using? Are you sure it's Java and not ECMAScript (sometimes called JavaScript)? Because the statement

var s="";

sure looks like the latter.
Feb 4 '08 #4
kcdoell
230 100+
The Adobe software says the language needs to be JavaScript. Like I said I have limited knowledge about Java so my coding is most likely wrong and that is why it is not working.....

I attempted to create a loop expression in the object called "Select All".

When that object is selected the Adobe software allows me to embedded the JavaScript (The code I posted) in different event selections; I choose the mouseup selection.
Feb 4 '08 #5
BigDaddyLH
1,216 Expert 1GB
The Adobe software says the language needs to be JavaScript. Like I said I have limited knowledge about Java so my coding is most likely wrong and that is why it is not working.....
JavaScript and Java are unrelated. I have moved this thread to the JavaScript forum.
Feb 4 '08 #6
acoder
16,027 Expert Mod 8TB
In JavaScript, you use the checked property to check a checkbox.
Feb 5 '08 #7
kcdoell
230 100+
Thanks, I will look into the link though it is all a little greek to me since I am a Newbie with Java Script.

Do you have an idea on how the code would go given my description? Should I apply the code in the button object that I have on the form called "Select All States"?
Feb 5 '08 #8
acoder
16,027 Expert Mod 8TB
If, in the code in the first post, getField does get the checkbox field, then instead of setting the value, set the checked property to true: getField(s).checked = true.
Feb 6 '08 #9
kcdoell
230 100+
I looked into the website link that was provided. It is referencing code that is for a web based application. Mine is in the pdf form itself so I am not understanding the correct coding due to the other tagging references which are probably not all relevant to my problem.

I have tried several things in the mouseup and click event with no positive results. On my form the check boxes are not checked. I simply want to create a button that would check all the "check boxes"

Does anybody have any idea where I am going wrong????

Thanks,

Keith.
Feb 6 '08 #10
acoder
16,027 Expert Mod 8TB
Sorry, I'm not too familiar with Adobe's PDF JavaScript, but if you post your code, I can have a look and maybe come up with suggestions.
Feb 6 '08 #11
kcdoell
230 100+
Expand|Select|Wrap|Line Numbers
  1. var s="";
  2. for(var i=1;i<51;i++){
  3.     s="SS."+i;
  4.     getField(s).value="Yes"
  5. }
Feb 6 '08 #12
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. var s="";
  2. for(var i=1;i<51;i++){
  3.     s="SS."+i;
  4.     getField(s).checked=true;
  5. }
Feb 7 '08 #13
kcdoell
230 100+
Thanks, I tried that with still the same none action response when I click on my "select All" button. This one should be easier. I have been scouting around on the web for solutions but to no avail, just ideas to look into a 500 + page adobe javascript manual.... which does not specifically address what I am trying to accomplish.

Anymore ideas let me know.

Take care,

Keith.
Feb 7 '08 #14
acoder
16,027 Expert Mod 8TB
So the problem is getting this to work on clicking the button? Can you check a checkbox using code without clicking the button?
Feb 8 '08 #15
kcdoell
230 100+
The only way that I can get the checkbox to have a check is to click on it manually.
Feb 8 '08 #16
acoder
16,027 Expert Mod 8TB
So you have two problems. What I suggest is try getting a checkbox checked using JavaScript first and then worry about getting it to work on clicking a button.

Also try an alert popup to test that you can run code when a button is clicked.
Feb 8 '08 #17
kcdoell
230 100+
Hello:

I am a Newbie at JavaScript so please be patient and kind. I am currently creating a form using Adobe LiveCycle Designer 8.0.

On my form I have a section that displays 50 check boxes representing 50 states in the USA. On my form it is reasonable that a end user could select some or all of the states. To that end, I want to have a checkbox or button that will select and deselect all of the State checkboxes. So far I have added a button called "Select All" and on the click event I wrote the following script:

Expand|Select|Wrap|Line Numbers
  1. xfa.form.topmostSubform.Page2.CKSS_AL.rawValue=1 
  2. xfa.form.topmostSubform.Page2.CKSS_AK.rawValue=1 
  3. xfa.form.topmostSubform.Page2.CKSS_AR.rawValue=1 
  4. xfa.form.topmostSubform.Page2.CKSS_AZ.rawValue=1 
  5. xfa.form.topmostSubform.Page2.CKSS_CA.rawValue=1 
  6.  
etc.....

As you can see I have named my checkboxes CKSS_AL, CKSS_AK,,,etc…..CKSS_WY.

This works, but I am thinking that there must be a more efficient way of writing this code. So with that said I took an idea to build an array:

Expand|Select|Wrap|Line Numbers
  1. var stateArray = new Array("AL", "AK", "AR"); 
  2. for ( var state in stateArray ) 
  3. var oField = xfa.resolveNode("xfa.topmostSubform.Page2.CKSS_" + stateArray[state]); 
  4. oField.rawValue = 1; 
  5.  
I only did the array for the first 3 states/checkboxes. Then I copied it into the click event of my "SelectAll" button. I received the following error:

oField has no properties
5:XFA:topmostSubform[0]:Page2[0]:SelectAll[0]:click
oField has no properties
5:XFA:topmostSubform[0]:Page2[0]:SelectAll[0]:click

Any ideas what I am missing? I have no idea what these error messages mean to solve....

Thanks,

Keith.
Feb 20 '08 #18
hsriat
1,654 Expert 1GB
Hello:

I am a Newbie at JavaScript so please be patient and kind. I am currently creating a form using Adobe LiveCycle Designer 8.0.

On my form I have a section that displays 50 check boxes representing 50 states in the USA. On my form it is reasonable that a end user could select some or all of the states. To that end, I want to have a checkbox or button that will select and deselect all of the State checkboxes. So far I have added a button called "Select All" and on the click event I wrote the following script:

xfa.form.topmostSubform.Page2.CKSS_AL.rawValue=1
xfa.form.topmostSubform.Page2.CKSS_AK.rawValue=1
xfa.form.topmostSubform.Page2.CKSS_AR.rawValue=1
xfa.form.topmostSubform.Page2.CKSS_AZ.rawValue=1
xfa.form.topmostSubform.Page2.CKSS_CA.rawValue=1

etc.....

As you can see I have named my checkboxes CKSS_AL, CKSS_AK,,,etc…..CKSS_WY.

This works, but I am thinking that there must be a more efficient way of writing this code. So with that said I took an idea to build an array:

var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode("xfa.topmostSubform.Page2.CKSS_" + stateArray[state]);
oField.rawValue = 1;
}

I only did the array for the first 3 states/checkboxes. Then I copied it into the click event of my "SelectAll" button. I received the following error:

oField has no properties
5:XFA:topmostSubform[0]:Page2[0]:SelectAll[0]:click
oField has no properties
5:XFA:topmostSubform[0]:Page2[0]:SelectAll[0]:click

Any ideas what I am missing? I have no idea what these error messages mean to solve....

Thanks,

Keith.

you may use this instead
[html]<input name="all" type="checkbox" onclick="checkAll()"></input>[/html]
Expand|Select|Wrap|Line Numbers
  1. function checkAll() {
  2.   for (var i=0; i<document.formName.elements.length; i++) {
  3.     var e=document.formName.elements[i];
  4.     if ((e.name != 'all') && (e.type=='checkbox'))
  5.     e.checked=document.formName.all.checked;
  6.   }
  7. }
Feb 20 '08 #19
kcdoell
230 100+
Thanks but when I pasted the script into my click event and then went to the preview mode and click on the select all button nothing happen.

Expand|Select|Wrap|Line Numbers
  1. function checkAll() {
  2.   for (var i=0; i<document.formName.elements.length; i++) {
  3.     var e=document.formName.elements[i];
  4.     if ((e.name != 'all') && (e.type=='checkbox'))
  5.     e.checked=document.formName.all.checked;
  6.   }
  7. }
  8.  
I know that the Adobe liveCycle designer has different JavaScript commands than previous versions. Could that be the issue?
Feb 20 '08 #20
kcdoell
230 100+
Okay; to my button called "Select All" on the click event I wrote the following script:

Expand|Select|Wrap|Line Numbers
  1. xfa.form.topmostSubform.Page2.CKSS_AL.rawValue=1 
  2. xfa.form.topmostSubform.Page2.CKSS_AK.rawValue=1 
  3. xfa.form.topmostSubform.Page2.CKSS_AR.rawValue=1 
  4. xfa.form.topmostSubform.Page2.CKSS_AZ.rawValue=1 
  5. xfa.form.topmostSubform.Page2.CKSS_CA.rawValue=1 
  6.  
etc.....

As you can see I have named my checkboxes CKSS_AL, CKSS_AK,,,etc…..CKSS_WY.

This works, but as I mentioned earlier, I am thinking that there must be a more efficient way of writing this code. So with that said I took an idea to build an array:

Expand|Select|Wrap|Line Numbers
  1. var stateArray = new Array("AL", "AK", "AR"); 
  2. for ( var state in stateArray ) 
  3. var oField = xfa.resolveNode("xfa.topmostSubform.Page2.CKSS_" + stateArray[state]); 
  4. oField.rawValue = 1; 
  5.  
I only did the array for the first 3 states/checkboxes. Then I copied it into the click event of my "SelectAll" button. I received the following error:

oField has no properties
5:XFA:topmostSubform[0]:Page2[0]:SelectAll[0]:click
oField has no properties
5:XFA:topmostSubform[0]:Page2[0]:SelectAll[0]:click

Any ideas what I am missing? I have no idea what these error messages mean to solve....

Thanks,

Keith.
Feb 20 '08 #21
kcdoell
230 100+
Got some help and finally got this one solved:

Expand|Select|Wrap|Line Numbers
  1. var stateArray = new Array("AL", "AK", "AR"); 
  2. for ( var state in stateArray ) 
  3. var oField = xfa.resolveNode("xfa.form.topmostSubform.Page2.CKSS_" + stateArray[state]); 
  4. oField.rawValue = 1; 
  5.  
Keith.
Feb 20 '08 #22
kcdoell
230 100+
Got some help from another friend and finally got this one solved:

Expand|Select|Wrap|Line Numbers
  1. var stateArray = new Array("AL", "AK", "AR"); 
  2. for ( var state in stateArray ) 
  3. var oField = xfa.resolveNode("xfa.form.topmostSubform.Page2.CKSS_" + stateArray[state]); 
  4. oField.rawValue = 1; 
  5.  
Keith.
Feb 20 '08 #23
hsriat
1,654 Expert 1GB
Got some help from another friend and finally got this one solved:

var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode("xfa.form.topmostSubform.Page2.CKS S_" + stateArray[state]);
oField.rawValue = 1;
}

Keith.
Buddy, you got to change the document and formName to the ones used by you.
I dunno about Adobe thing, I never used it.
Feb 21 '08 #24
acoder
16,027 Expert Mod 8TB
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

MODERATOR.
Feb 21 '08 #25
acoder
16,027 Expert Mod 8TB
Got some help and finally got this one solved:
Maybe I'm missing something, but how is this different from what you posted before?

PS. merged duplicate threads.
Feb 21 '08 #26
kcdoell
230 100+
Maybe I'm missing something, but how is this different from what you posted before?

PS. merged duplicate threads.
Acoder:

My JavaScript before was the following:

Expand|Select|Wrap|Line Numbers
  1. var stateArray = new Array("AL", "AK", "AR"); 
  2. for ( var state in stateArray ) 
  3. var oField = xfa.resolveNode("xfa.topmostSubform.Page2.CKSS_" + stateArray[state]); 
  4. oField.rawValue = 1; 
  5. }
  6.  
all that was missing was a the word "form."

The end solutions was the following:

Expand|Select|Wrap|Line Numbers
  1. var stateArray = new Array("AL", "AK", "AR"); 
  2. for ( var state in stateArray ) 
  3. var oField = xfa.resolveNode("xfa.form.topmostSubform.Page2.CKSS_" + stateArray[state]); 
  4. oField.rawValue = 1; 
  5. }
  6.  
Take care,

Like I had mentioned before, my knowledge on Javascript is limited but it appears that the problem was path related.

Keith.
Feb 27 '08 #27
acoder
16,027 Expert Mod 8TB
all that was missing was a the word "form."
Oh right, so it was. Thanks for posting and glad you got it working.

JavaScript on Adobe PDF can be difficult if you're used to the normal standard JavaScript.
Feb 28 '08 #28

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Edward | last post by:
The following html / javascript code produces a simple form with check boxes. There is also a checkbox that 'checks all' form checkboxes hotmail style: <html> <head> <title></title> </head>...
9
by: Shyguy | last post by:
I have two forms that both open the same (3rd) form. The third form does the same thing, but a little differently depending on which form it is opened from. Is there a way I can check which form...
4
by: Gene | last post by:
As my purpose is to load one form at a time, so I want to unload another form before loading the form. But how to check which form is being load, so I can unload it first.
5
by: rob willaar | last post by:
Hi, How can i check is a form is disposed in framework 1.1 In framework 2.0 i can check Form.IsDisposed to check if a user closed the form
3
by: Legi | last post by:
Well I have very very simple problem. I have three NumericFields prepeared id Adobe Designer. I would like to add values from thirs two fields and show sum in the third one. So I'm choosing...
9
by: KelsMckin | last post by:
Hello, I was wondering if there was a way to check there was already a form open before opening a new one, sorry that doesnt seem clear, here is an example: The following button opens a new form...
3
by: frenchy | last post by:
I am getting this error in Adobe after struggling with a 'submit' button on an acrobat form that is in production and all the other appdev people in the office are NOT having a problem with. It...
8
by: News Microsoft | last post by:
Hi there. I would like to know how can I test if a Form exists. This is the situation: I have a single Form in my application. My objective is, when I minimize the form, it will disapear and a...
5
by: wassimdaccache | last post by:
Hello everybody I'm using access 2003 Sometimes I use to open more than form in my project what I need is to check another form if still opened For example I have : form name X,Y,Z
2
by: S_K | last post by:
Hi, I have a problem in which I have to insert data from an ASP.NET form into an Adobe (.pdf) form. How can I do this? Thanks. Steve
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.