Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to insert a "clear" button to a specific field

Avatar

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
ICETS_1
Level 1

21-02-2011

I want to add a button that results in a specific field being cleared or reset in my form without it actually resetting the whole form.  I have dabbled with with some script but it seems to rest the whole form.

For example I have a group of fields in page 3 where the user selects a course units from a drop down menu (i.e.DropDownList1, DropDownList2 etc..).  I want to put a button beside this group of fields so they can reset the field group.  In saying this I need to know how to group the 5 fields together so the 'clear' button clears that group of fields.

In you answer can you also indicate with of the selection in the "Show" drop down menu I need to select.  E.g. is it click, mouseup, mousedown, etc...

Accepted Solutions (0)

Answers (7)

Answers (7)

Avatar

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile
Niall_O_Donovan
Level 10

21-02-2011

Hi Craig,

You need to publish/share the file on Acrobat.com.

Acrobat.com.png

Until you do this, I can't access the file.

Niall

Avatar

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
ICETS_1
Level 1

21-02-2011

Thanks Niall

The link to the doc is

https://acrobat.com/#d=FM1vC*TftqRKzedpj8fy4A

Craig Doran

Investigation, Compliance and Enforcement Training Systems.

(ICETS)

www.icets.com.au

Please consider the environment before printing this e-mail

This e-mail and its attachments are intended for the named addressee only and no liability is accepted for use or reliance on any part of this e-mail by any other person. It is confidential, may be subject to privilege and is also subject to copyright. No part of it should be reproduced, adapted or communicated without the written consent of the copyright owner. Any confidentiality or privilege is not waived or lost because this e-mail has been received by you if you are not the intended recipient.

Avatar

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile
Niall_O_Donovan
Level 10

21-02-2011

No problem,

If you upload it to a file sharing site, like Acrobat.com and then either post the published URL here or PM me.

N.

Avatar

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
ICETS_1
Level 1

21-02-2011

Man I am thinking I am entering the scripting retard categories

Am I able to email you the form to look at so we are on the same page.  No problem if this is asking a bit much.  The button I want to add the script to is one page 3 and is titled "reset electives"

Avatar

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile
Niall_O_Donovan
Level 10

21-02-2011

No problem,

From another post, it looks like you are trying to reset five dropdowns. Is that correct?

Forms developed in LC Designer use a Scripting Object Model. What this means is that you access objects on the form using SOM Expressions. You can specify a relative SOM Expression, which is the path from the button to the dropdown. if they were in the same subform/page, then it would look like this:

dropdown1

But if they were separated by a subform the relative SOM Expression could look like this:

subform1.dropdown1

The other type of expression is an absolute SOM Expression. This is a reference that is fully stated from the XFA root node, for example:

xfa[0].form[0].form1[0].page6[0].subform1[0].dropdown1[0]

Generally when you are scripting relative SOM Expressions are perfectly adequate. But in building up the resetData string, I am using somExpression to give the absolute SOM Expression for each object.

I am working up an example demonstrating SOM Expressions. It is DRAFT and unfinished, but it might help. It currently only contains two examples and no supporting text. When I have it finished I will put it up on our website. I would appreciate any feedback you have:

https://acrobat.com/#d=pYPfN4-M5itwx0hNLjZk5A

Back to the script.

Here we are using variables to build up a comma-separated string that contains the absolute SOM Expressions for the five dropdowns. You will need to replace dropdown1 for the name of your objects. Once we have the f5 variable, we pass this in the resetData function. Also this Javascript is in the click event of the button.

// reset dropdowns only

var f1 = dropdown1.somExpression + ", ";

var f2 = f1 + dropdown2.somExpression + ", ";

var f3 = f2 + dropdown3.somExpression + ", ";

var f4 = f3 + dropdown4.somExpression + ", ";

var f5 = f4 + dropdown5.somExpression;


xfa.host.resetData(f5);

  1. You do not need to group the dropdown objects.
  2. The script above should work, based on the reset button and the dropdowns being on the same page.
  3. I would put the script in the click event of the button.

Hope that helps. Come back if you are still having trouble.

Niall

Assure Dynamics

Avatar

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
ICETS_1
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
ICETS_1
Level 1

21-02-2011

Sorry Niall

I am only new to scripting.  Can you provide some more simpler instructions for the following.

I want to clear all the fields on a specific page with a button without clearing entire form.

1. Do I need to somehow group the fields on that page together.

2. What would be the script type to clear those fields on that page

3. What selection in the "Show" drop down field should I use to enter that script.

Avatar

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile
Niall_O_Donovan
Level 10

21-02-2011

Hi,

You can use the xfa.host.resetData(); method.

This resets the whole form. If you want to specify specific fields, then you can build up a string of references and then specify this in the command.

For example:

// reset page 6 only

var f1 = Table1.Row1.description.somExpression + ", ";

var f2 = f1 + Table1.Row1.quantity.somExpression + ", ";

var f3 = f2 + Table1.Row1.unitPrice.somExpression + ", ";

var f4 = f3 + positionedSF.myName.somExpression + ", ";

var f5 = f4 + positionedSF.myAddress.somExpression;

xfa.host.resetData(f5);

You can see this in action here: http://assure.ly/gBJYj9, Table 5.

Hope that helps,

Niall

Assure Dynamics