cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically making fields editable or non editable according to ddl value.

Sarang_Akhare
Explorer
0 Kudos

Hi All,

In my case I have a drop down field having various values on ADOBE form.According to those values the remaining fields in the form should get visible or invisible accordingly. Can you please help me out in javascripting required in this case?

I have tried scripting as given below but it is not working. I request you to please tell me whats the problem in this and what needs to be done to achieve this.

For Example in case if i select "03 - Transfer" in the dropdown field named OPTION then I want to make New Personal Sub area field as visible and editable on the form so that user can enter data into it ELSE it should not be visible on the form.For this the scripting i wrote in javascript in the event CALCULATE for this field is as follows.

if($record.OPTION.DATA.FIELD == "03 - Transfer")

then

this.access == "open"

else

this.presence = "invisible"

endif

But this is not working when I check the form on portal.Please let me know what I need to do inorder to achieve this functionality.

I have wrote the similar code in CALCULATE event for each field on the form but the form not working according to requirement.

Please provide me with information how to decide the event in which we should write the script?

Please let me know if this functionality can be achieved by coding in F.M in ABAP?If yes how?

Thanks in Advance.

Sarang

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Sarang,

Write the following JavaScript code in the exit event of drop-down as follows:-

if(this.rawValue == "03 - Transfer")
{
	<Your New Personal Sub Area Fieldname >.access = "open";
	<Your New Personal Sub Area Fieldname >.presence = "visible";
}

Also write the following JavaScript code in the form:ready event of the Main Subform:-

<Your New Personal Sub Area Fieldname >.access = "readOnly";
<Your New Personal Sub Area Fieldname >.presence = "hidden";

Also make sure that the form is dynamic.

Chintan

Sarang_Akhare
Explorer
0 Kudos

Hi Chintan,

Thanks for the reply. The scripting I used in my case is as follows.But this is not working.Please let me know what may the problem.

In the dropdown in EXIT event I wrote the following javascript.

if(this.rawValue == "01 - Promotion")

{

DATA.MainSubform.Subform3.EFF_DATE.access = "open";

DATA.MainSubform.Subform3.EFF_DATE.presence = "visible";

}

and in the main subform I have wrote the following script as u told in the FORM READY event

DATA.MainSubform.Subform3.EFF_DATE.access = "readOnly";

DATA.MainSubform.Subform3.EFF_DATE.presence = "hidden";

According to this script the at first when the form is opened the EFF_DATE field should be invisible and should only get visible when the user selects "01 - Promotion" from the drop down.

Note - "01 - Promotion" is one of the values from the drop down

Also Please let me know what needs to be done to make the form dynamic.

waiting for ur reply.

Thanks in Advance,

Sarang.

chintan_virani
Active Contributor
0 Kudos

Sarang,

Put a messageBox before the if condition in the exit event and see what's the exact value you from the drop-down.

xfa.host.messageBox("Value is:"+this.rawvalue);
if(...)
...
...

Open the form properties in LiveCycle Designer and see if you have the the XDP Preview format as "Acrobat 7.0.5 Dynamic PDF"

If it still does not work then if possible send over the form to me.

Chintan

Sarang_Akhare
Explorer
0 Kudos

Hi Chintan,

Thanks very much for the quick response.

The value which the pop up gives is "undefined".Thats the reason why the remaining script is not working as the values in the dropdown are not getting populated in the OPTION field.

Please let me know where to check for this and how to rectify this.

Thanks in Advance ,

Sarang

chintan_virani
Active Contributor
0 Kudos

Sarang,

Try below code in change event and see if you get get the current selected value from drop-down:-

xfa.host.messageBox("Current Value is " + xfa.event.change);
 
OR
 
xfa.host.messageBox("Current Value is " + xfa.event.newText);

Alternatively can you send me the form please....

Chintan

Answers (0)