Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

make a text field flashing or highlight?

Avatar

Level 7

There is any way when you click on a button to make a text field flashing or highlight?

I want to make some points on a map to be easy visible for a user

How I can do this?

Any ideas or suggestion?

Thanks

8 Replies

Avatar

Level 10

Hi,  Stefan Cameron has an example of highlighting invalid fields, maybe you can modify his sample, http://forms.stefcameron.com/2006/08/15/invalid-flashing-fields-20/, Regards Bruce

Avatar

Level 7

Hi Bruce, this is great example!

THANK YOU!

I have try to modify it for my project but without luck!

Here is my Buttons:

DepartmentA

DepartmentB

DepartmentC

When the user clicks on DepartmentA I'll like the field: AreaA to flash

When the user clicks on DepartmentB I'll like the field: AreaB to flash

When the user clicks on DepartmentC I'll like the field: AreaC to flash

Text Fields:

AreaA

AreaB

AreaC

How Cameron's script can work in this case?

Thanks

Avatar

Level 10

Assuming your buttons and text fields are at the same level in the form hierarchy you should be able to put the following JavaScript into the AreaA button.

app.AreaAInterval = app.setInterval(

  "var f =  xfa.form.resolveNode('" +

    AreaA.somExpression + "');  " +

  "if (f.ui.oneOfChild.border.fill.color.value == '255,0,0')" +

    "{ f.ui.oneOfChild.border.fill.color.value = '232,232,232'; }" +

  "else" +

    "{ f.ui.oneOfChild.border.fill.color.value = '255,0,0'; }",

500);

Then for AreaB and AreaC buttons it is the same code but replace the two occurences of AreaA with AreaB (or AreaC).

Avatar

Level 7

Thank you BR001

One more thing

In case a user clicks on DepartmentA for examlple and then clikcs on Department B,

is it possible the AreaA to stop flashing and only the areaB to be flashing.

If a user click to another department I want I like the previous state to be deleted.

Is this possible?

Thank you

Avatar

Level 10

You can stop the flashing with the following code;

app.clearInterval(app.AreaAInterval);

Again change AreaAInterval to the appropriate value.

Bruce

Avatar

Level 7

Bruce thanks agiain for all your help!

It works fine and stop flashing whan I use on click event:

app.clearInterval(app.AreaAInterval);

But the color of the field remain red.

How I can make the field color to have it's original color than red?

Thank you Bruce

Avatar

Level 10

Hi,

I had not thought of that, if you stop the flashing during the half a second it is flashing then it will stay red.

Try adding the following after the clearInterval

AreaA.ui.oneOfChild.nodes.remove(AreaA.ui.oneOfChild.border);

Which will remove the border element from the Form DOM so will revert back to the definition of the Template DOM.

Regards

Bruce

Avatar

Level 7

Thank you Bruce for all your help.

Works perfect!