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.
SOLVED

Place a value from a xfa host response to a text box form field

Avatar

Former Community Member

I have an annual leave form which has numerous types of leave to select with check boxes.

If the annual leave check box is marked then a message box will prompt the user if public holidays are to be included.

The user will populate the response field with the number of public holidays included in a leave period.

I would then like the user input (number of public holidays) from the response field to be placed in a separate text box on the form.

The message box and response box appears to be working as they should, but I cannot work out how to get the value from the response into the text box.

Can any one please provide assistance with modifying my script as follows:

if (Annual_Leave.rawValue == "1") then

if ($host.messageBox("Does your leave application include public holidays?","Public Holidays",2,2) == 4) then

Public_Holiday.value = $host.response("Enter the number of public holidays included in your leave period!","Number of Public Holidays")

else

""

endif

else

""

endif

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi,

I have developed a form with javascript code,

Code goes here,

form1.#subform[0].Button1::click - (JavaScript, client)
if(TextField1.rawValue==1)
{
var p=xfa.host.messageBox("Does your leave application include public holidays?","Public Holidays",2,2);
if(p==4)
{
var q=xfa.host.response("Enter the number of public holidays included in your leave period!","Number of Public Holidays");
TextField2.rawValue=q;

}

}

View solution in original post

4 Replies

Avatar

Correct answer by
Level 3

Hi,

I have developed a form with javascript code,

Code goes here,

form1.#subform[0].Button1::click - (JavaScript, client)
if(TextField1.rawValue==1)
{
var p=xfa.host.messageBox("Does your leave application include public holidays?","Public Holidays",2,2);
if(p==4)
{
var q=xfa.host.response("Enter the number of public holidays included in your leave period!","Number of Public Holidays");
TextField2.rawValue=q;

}

}

Avatar

Level 9

Hello ,

I did some hit and trial to your issue and developed a simple form .I am here giving you the link .Have a look at it.

https://acrobat.com/#d=ys5bFS5X3-WYTDaPDylBMw

Avatar

Former Community Member

Thank you very much for your help, success at last.

I have revised my script and the value from the response dialog has been included in the text box field.

Revised script as follows:

if (Annual_Leave.rawValue == "1")

{

var p = xfa.host.messageBox("Does your leave application include public holidays?","Public Holidays",2,2);

if (p==4)

{

var q = xfa.host.response("Enter the number of public holidays included in your leave period!","Number of Public Holidays"); xfa.form.topmostSubform.Page1.Public_Holiday.rawValue = q;

}

}

Avatar

Former Community Member

Thank you very much for your help, I appreciate the time you have taken.