Converting PDF to XDP form | Community
Skip to main content
October 6, 2021
Solved

Converting PDF to XDP form

  • October 6, 2021
  • 2 replies
  • 1523 views

I am in the process of converting my PDF forms in AEM to XDP form. For one particular date field, I have some logic coded in the exit event. I see that the exit event fires if I click over to the next field, but does not fire if I tab over to the next field. Does anyone know what I need to do so that the exit event fires consistently when I either click OR tab to the next field?

 

I also notice that sometimes the code I have in the enter event of certain fields seem to fire multiple times instead of just once and I don't know why that is happening. Any insight and help would be much appreciated.

 

Thanks,

Ravi.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mayank_Tiwari

FYI, the exit event on a date field is fired in these situations:

1. When you set the value in the date field.

2. when the field lose focus due to mouse click.

3. when the field lose focus due to tab out.

 

To verify the script is executing every time, use the following script.

 

if ( this.rawValue == null || this.rawValue == "" || this.parent.LvStart.rawValue == null || this.parent.LvStart.rawValue == "" )
{

xfa.host.messageBox("Start date or end date are blank");
}
else {
xfa.host.messageBox("End date set to -"+this.rawValue);
}

if ( this.rawValue < this.parent.LvStart.rawValue)
{
xfa.host.messageBox("Leave End Date cannot be less than Leave Start Date.");
this.rawValue = "";
xfa.host.setFocus(this);
}

 

I tried this and this works as expected.

 

The issue with the enter event might be because of using setFocus() method, which invokes the Enter event only.

2 replies

nowackem
October 6, 2021

Hi @ravimram 

Are you able to delete this comment here? I accidentally commented on the lock fields in the wrong thread and I just cant get this comment deleted. I wouldnt worry about it but now there are comments about the lock field having nothing to do with your thread. Ha! Again sorry about this. 

Pulkit_Jain_
Adobe Employee
Adobe Employee
October 6, 2021

@ravimram 

For issue with Date field exit event, could you please share the logic you've implemented? We can check the issue in-house with the latest build if this is genuine issue.

For issue with events getting triggered multiple times, it could be the case that the event is propagated across the heirarchy of the form/subform. I am not sure if you're taking the PDFForm as the blueprint for creating the XDP but i'd suggest that you refer the Designer scripting guide- https://helpx.adobe.com/content/dam/help/en/experience-manager/6-5/forms/pdf/scripting-reference.pdf 

 

 

RaviMRamAuthor
October 6, 2021

Hi Pulkit,

 

Thanks for your time to share your comments. Somebody else had commented that if I go Edit -> Lock in designer and uncheck anything that's checked and that somehow seemed to make it better i.e. the exit event seems to fire more often (although sometimes it still doesn't). Below's my code snippet.

Yes, I am taking my PDF form and saving it as XDP and then trying to get it to work. I am hoping I can do that otherwise, it's a lot of work to start over from scratch.

Thanks for the Designer Scripting guide, but if I had the time and patience to read through a 786 page document and digest it, I wouldn't be posting here 😋. Let me know if you had any other insight. Thanks.

 

 

form1.MainForm.LeaveInfo.CurrLeaveInfo.LvEnd::exit - (JavaScript, client)

if ( this.rawValue == null || this.rawValue == "" || this.parent.LvStart.rawValue == null || this.parent.LvStart.rawValue == "" )
{
}
else {
xfa.host.validationsEnabled = true;
xfa.host.messageBox("End date set to -"+this.rawValue);
if ( this.execValidate() == true )
{
if ( this.rawValue < this.parent.LvStart.rawValue)
{
xfa.host.messageBox("Leave End Date cannot be less than Leave Start Date.");
this.rawValue = "";
xfa.host.setFocus(this);
}
}
else
{
xfa.host.setFocus(this);
}
xfa.host.validationsEnabled = false;
}

--

Mayank_Tiwari
Adobe Employee
Mayank_TiwariAdobe EmployeeAccepted solution
Adobe Employee
October 7, 2021

FYI, the exit event on a date field is fired in these situations:

1. When you set the value in the date field.

2. when the field lose focus due to mouse click.

3. when the field lose focus due to tab out.

 

To verify the script is executing every time, use the following script.

 

if ( this.rawValue == null || this.rawValue == "" || this.parent.LvStart.rawValue == null || this.parent.LvStart.rawValue == "" )
{

xfa.host.messageBox("Start date or end date are blank");
}
else {
xfa.host.messageBox("End date set to -"+this.rawValue);
}

if ( this.rawValue < this.parent.LvStart.rawValue)
{
xfa.host.messageBox("Leave End Date cannot be less than Leave Start Date.");
this.rawValue = "";
xfa.host.setFocus(this);
}

 

I tried this and this works as expected.

 

The issue with the enter event might be because of using setFocus() method, which invokes the Enter event only.