Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Clear/Reset the InputField columns to Default/Zero- Possible?

Hi All,

I have an InputField Inline Table in Script, like this below -

InfuptField Start, End, Duration;

Table:

Load * Inline [

Start, End, Duration

0, 0, 0

0, 0, 0

0, 0, 0

0, 0, 0

0, 0, 0

0, 0, 0

];


User can enter their desired values in the Table and see their calculations in report.


Is there any Button Action to clear/reset the InputField columns back to their default state (or Zeros in this case)?

Please provide any suggestions to achieve this.

1 Solution

Accepted Solutions
dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi petter-s

I used this VBScript to use in Macro to reset the values and its working well in Chrome, Firefox, IE.

However, I also want to convert this into a JScript - Could you please help?

sub Reset
     set obj = ActiveDocument.Fields("Low")
     Obj.ResetInputFieldValues 0, x
     set obj = ActiveDocument.Fields("High")
     Obj.ResetInputFieldValues 0, x
     set obj = ActiveDocument.Fields("Percent")
     Obj.ResetInputFieldValues 0, x

end sub

View solution in original post

6 Replies
petter
Partner - Champion III
Partner - Champion III

You can do it with a a button and a macro

dmohanty
Partner - Specialist
Partner - Specialist
Author

Thanks petter-s

While exploring, I got to know that this Macro can help -

sub reset

     set fld = ActiveDocument.Fields("inputtable")

      fld.ResetInputFieldValues 0, x

end sub

I will test this for sure, but not sure if that will work on AJAX mode browsers.

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi petter-s

I used this VBScript to use in Macro to reset the values and its working well in Chrome, Firefox, IE.

However, I also want to convert this into a JScript - Could you please help?

sub Reset
     set obj = ActiveDocument.Fields("Low")
     Obj.ResetInputFieldValues 0, x
     set obj = ActiveDocument.Fields("High")
     Obj.ResetInputFieldValues 0, x
     set obj = ActiveDocument.Fields("Percent")
     Obj.ResetInputFieldValues 0, x

end sub

petter
Partner - Champion III
Partner - Champion III

This should work:

function reset() {

    var obj = ActiveDocument.Fields('Low');

    var r = obj.ResetInputFieldValues(0);

    var obj = ActiveDocument.Fields('High');

    obj.ResetInputFieldValues(0);

    var obj = ActiveDocument.Fields('Percent');

    obj.ResetInputFieldValues(0);

}

dmohanty
Partner - Specialist
Partner - Specialist
Author

petter-s

Thank you. This works well too in AJAX.

jafari_ervin
Creator III
Creator III

you should right click on the input column in the table then select  RestoreValue ->Restore All Value