The only way that I can get the checkbox to have a check is to click on it manually.
Check All Box with on a Adobe 8.0 pdf form
Collapse
X
-
CheckBox Select All
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:
[CODE=javascript]xfa.form.topmos tSubform.Page2. CKSS_AL.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AK.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AR.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AZ.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_CA.rawValu e=1
[/CODE]
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:
[CODE=javascript]var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode ("xfa.topmostSu bform.Page2.CKS S_" + stateArray[state]);
oField.rawValue = 1;
}
[/CODE]
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:topmostSu bform[0]:Page2[0]:SelectAll[0]:click
oField has no properties
5:XFA:topmostSu bform[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.Comment
-
Originally posted by kcdoellHello:
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.topmos tSubform.Page2. CKSS_AL.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AK.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AR.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AZ.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_CA.rawValu e=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.topmostSu bform.Page2.CKS S_" + 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:topmostSu bform[0]:Page2[0]:SelectAll[0]:click
oField has no properties
5:XFA:topmostSu bform[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="checkA ll()"></input>[/html]
[CODE=javascript]
function checkAll() {
for (var i=0; i<document.form Name.elements.l ength; i++) {
var e=document.form Name.elements[i];
if ((e.name != 'all') && (e.type=='check box'))
e.checked=docum ent.formName.al l.checked;
}
}[/CODE]Comment
-
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.
[CODE=javascript]function checkAll() {
for (var i=0; i<document.form Name.elements.l ength; i++) {
var e=document.form Name.elements[i];
if ((e.name != 'all') && (e.type=='check box'))
e.checked=docum ent.formName.al l.checked;
}
}
[/CODE]
I know that the Adobe liveCycle designer has different JavaScript commands than previous versions. Could that be the issue?Comment
-
Okay; to my button called "Select All" on the click event I wrote the following script:
[CODE=javascript]xfa.form.topmos tSubform.Page2. CKSS_AL.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AK.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AR.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_AZ.rawValu e=1
xfa.form.topmos tSubform.Page2. CKSS_CA.rawValu e=1
[/CODE]
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:
[CODE=javascript]var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode ("xfa.topmostSu bform.Page2.CKS S_" + stateArray[state]);
oField.rawValue = 1;
}
[/CODE]
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:topmostSu bform[0]:Page2[0]:SelectAll[0]:click
oField has no properties
5:XFA:topmostSu bform[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.Comment
-
Got some help and finally got this one solved:
[CODE=javascript]var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode ("xfa.form.topm ostSubform.Page 2.CKSS_" + stateArray[state]);
oField.rawValue = 1;
}
[/CODE]
Keith.Comment
-
Got some help from another friend and finally got this one solved:
[CODE=javascript]var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode ("xfa.form.topm ostSubform.Page 2.CKSS_" + stateArray[state]);
oField.rawValue = 1;
}
[/CODE]
Keith.Comment
-
Originally posted by kcdoellGot 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.topm ostSubform.Page 2.CKSS_" + stateArray[state]);
oField.rawValue = 1;
}
Keith.
I dunno about Adobe thing, I never used it.Comment
-
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.Comment
-
Originally posted by acoderMaybe I'm missing something, but how is this different from what you posted before?
PS. merged duplicate threads.
My JavaScript before was the following:
[code=javascript]
var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode ("xfa.topmostSu bform.Page2.CKS S_" + stateArray[state]);
oField.rawValue = 1;
}
[/code]
all that was missing was a the word "form."
The end solutions was the following:
[code=javascript]
var stateArray = new Array("AL", "AK", "AR");
for ( var state in stateArray )
{
var oField = xfa.resolveNode ("xfa.form.topm ostSubform.Page 2.CKSS_" + stateArray[state]);
oField.rawValue = 1;
}
[/code]
Take care,
Like I had mentioned before, my knowledge on Javascript is limited but it appears that the problem was path related.
Keith.Comment
Comment