I have a form that that I can add pages to and then the data from those pages
populate to a schedule. I am tring to create a delete bu
tton that will allow me to delete the current page. I have
that working but the data from instances are still appearing on the schedule that was
populated when they wer created. How can I make the schedule refresh
or something. I am using 8.2 a click event with java:
Views
Replies
Total Likes
You can reset the data on the form..
xfa.host.resetData("<Provide the name of the Page here>");
Place the aboev command in the click event of the Delete button.
Are you hiding the page (or) are you deleting the instance by calling "removeInstance" method..
If you are hiding then you will see the data in the output XML. To avoid that you can reset all the fields in the Page by using the above command.
Thanks
Srini
Here is the script I just tried;
form1.Page1.instanceManager.removeInstance(parent.parent.index);
xfa.host.resetData(Form1.Page1.Schedule);
I did not receive any errors but the data on the schedule was still there.
Thanks
Views
Replies
Total Likes
This is the code that I am using to populate the schedule;
This is from the first line of the schedule.
if(_Page1.count >= 1){this.rawValue =
xfa.resolveNode("Page1[0].Body.Total").rawValue;}
Views
Replies
Total Likes
Just wondering if anyone has a solution for this. I have tried to use reset
also and that takes everything off. I have tried redraw as well as refresh.
Views
Replies
Total Likes
You would have to remove the data before you remove the page. So do the resetData first then the removeInstance.
Paul
Views
Replies
Total Likes
I tried that and hit deleted the current page but also deleted the data from
the remaining invoices. This the code I used;
xfa.host.resetData("form1.page1");
form1.Page1.instanceManager.removeInstance(parent.parent.index);
Views
Replies
Total Likes
Firstly the page1 on the resetData is lowercase and the Page 1 in the removeInstance is upper case P. These are supposed to be refering to the same object but they are spelled differently. Second, the Page1 you are removing has an index number (this.parent.parent.index) so when you reset you have to ind
icate which Page1 you want to reset so you will have to include the index....so the expression will need to look something like this:
xfa.host.resetData("form1.page1[" + this.parent.parent.index + "]")
Paul
Views
Replies
Total Likes
You are right. I made the change and it works great with 1 exception. The
only data that is left on the schedule is the date field. This field is auto
entered on the invoice. Is that why it is still appearing on the schedule.
Thanks so very much Paul.
Steve
Views
Replies
Total Likes
Yes that is correct.
The calcualtion is firing when the form is opened.
Paul
Views
Replies
Total Likes
Could I change the event that makes that happen? Like form ready or
initialize instead of calculate
Views
Replies
Total Likes
Yes ...I woudl put it on Doc Ready...that way it only runs when the form is opened. I assume that you have the calculaton wrapped in an if statement that will only execute the date calculation if the field is empty ...right?
Otherwise the Date will change to the current Date even if the form has been filled out.
Paul
Views
Replies
Total Likes
if (this.rawValue == null){
var msNow = (new Date()).getTime();
var d1 = new Date(msNow);
this.rawValue = util.printd("mm/dd/yy", d1);
}
else {
This the code but when I moved it to doc ready it did not populate
Views
Replies
Total Likes
Looks like your missing some code ....the else { shoudl have some code following it and at least a closing }
Paul
Views
Replies
Total Likes
I think I can get that now thanks. On the same form I have a date/time field
that I placed this script in but I can not get it to work either. I just
want it to return me the current time if the field is empty. I am doing that
if statement so the time will not get re set when the form is opened later.
Can you please look at this script;; I have it in form ready,formcalc
if (this.rawValue == null)
}
$ = (Num2Time(Time(), "HH:MM:SS"));
}
Else
{
this.rawValue = rawValue;
}
Thanks Steve
Views
Replies
Total Likes
Couple of issues with syntax in your code (the 2nd line shoudl be a { and the else is lowercase):
if (this.rawValue == null)
{
$ = (Num2Time(Time(), "HH:MM:SS"));
}
else
{
this.rawValue = rawValue;
}
Not sure what you are trying to accomplish in the 2nd last line ...but the right side of the equation makes no sense.
Paul
Views
Replies
Total Likes
I just want the current time to populate the field but if the form is opened
later after saving, I do not want the time to change.
Views
Replies
Total Likes
Then you do not need the else portion ....remove everything after the first }
Paul
Views
Replies
Total Likes
Views
Likes
Replies