cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe Form field display based on user

naimkhans_babi
Active Participant
0 Kudos

Dear Friends

I am creating one form. which has the three fields :

1) Telephone:

2) Email:

3) Portal Id:

My work scenario is when form reaches via workflow to Telefone person he / she only can enter data in the telephone field where he / she cant enter data in email and portal id field and this for all the fields like email guy has access to enter data only in email and portal will be for portal id, except concern person's field all other fields become read only.

I have design the form and successfully trigger it via UWL as well. but all the field are allow to enter data as i dont know how to controll them. I have the role in my bsp's controller do_init method but dont know how to utilize this info to set as read-only for non concern users.

Is ther any way to achieve this please tell me how I can achieve this functionality. your any help will be appreciated.

Thanking you

Regards

Naeem

Accepted Solutions (0)

Answers (1)

Answers (1)

chintan_virani
Active Contributor
0 Kudos

Not sure how BSP & Adobe combination works but you can give following a try.

1. Have a variable in Adobe form which contains the Role you want.

2. In the form:ready event in Adobe form, use JS/Formcalc and use the access property of the fields to enable/disable the fields.

For e.g. : Let's assume my form has a field called ROLE_VALUE which will give me roles as TEL,EMAIL,PID and the three fields are called tel,email,pid

Now in form:ready use following JavaScript

if(ROLE_VALUE == "TEL")               //form1.page1 - indicates you form hierarchy so change it accordingly.
{
    form1.page1.tel.access = "open";
    form1.page1.email.access = "readOnly";
    form1.page1.pid.access = "readOnly";
}
else if (ROLE_VALUE == "EMAIL")
{
    form1.page1.tel.access = "readOnly";
    form1.page1.email.access = "open";
    form1.page1.pid.access = "readOnly";
}
else if(ROLE_VALUE == "PID")
{
    form1.page1.tel.access = "readOnly";
    form1.page1.email.access = "readOnly";
    form1.page1.pid.access = "open";
}

Chintan

naimkhans_babi
Active Participant
0 Kudos

Dear Chintan

Thank you very much for your reply.. i incorporated your solution in following wat



---------data.#subform[0].TextField3::ready:form - (FormCalc, Client)-------------------------------
  <---- this is the line two and column 1

if(ROLE1 == "TEL")               //form1.page1 - indicates you form hierarchy so change it accordingly.
{
    form1.page1.phone.access = "open";
    form1.page1.email.access = "readOnly";
    form1.page1.portal.access = "readOnly";
}
else if (ROLE1 == "EMAIL")
{
    form1.page1.phone.access = "readOnly";
    form1.page1.email.access = "open";
    form1.page1.portal.access = "readOnly";
}
else if(ROLE1 == "PORTAL")
{
    form1.page1.phone.access = "readOnly";
    form1.page1.email.access = "readOnly";
    form1.page1.portal.access = "open";
}

I am receiving the following error at line 2 and column 1

" Script Failed ( language is FormClac;contex is xfa[0].form[0].data[0].#subform3[0].textField3)

Error syntax error near token '{' on line 2 column 1. could you please tell me where i m making mistake.

I am not using the sub-form.

for your information what I am doing is:

I have 7 input fields:

Form receives the values for the following fields from the BSP Page controller (do_request).

field 1 pernr ( read only)

field 2 emp_name (read only)

field 7 role1 (invisible)

by this function module

call function l_name
    exporting
      /1bcdwb/docparams  = fp_docparams
      pernr = emp_id
      emp_name = emp_name
      role1 = role1
    importing
      /1bcdwb/formoutput = fp_result
    exceptions

Form fields which properties need to be set on role

Field3 Telephone

Field4 Mobile (same as telephone and optional so not important)

Field5 Email

Field6 Portal

I have use the code on the above 4 fields.

Please help me to rectify the error I ll greatly appreciate your reply.

Thanking you

Regards

Naeem

Edited by: Naim Khan S Babi on Oct 8, 2009 4:13 PM

chintan_virani
Active Contributor
0 Kudos

You need to change the language to JavaScript, your code shows it's FormCalc.

Also put the code in the form:ready event of the top level main subform and not in form:ready event of any textfield.

Chintan

naimkhans_babi
Active Participant
0 Kudos

Hi Chintan

My form is still not taking any effect ...

I remove the if condition and put directly this script.. but still email and portal is not set as read-only programatically.

form1.page1.TextField3.access = "open";
     form1.page1.TextField5.access = "readOnly";
     form1.page1.TextField6.access = "readOnly";

Regards

Naeem

chintan_virani
Active Contributor
0 Kudos

I assume you are developing an Interactive form and not print form, because if it is interactive it should work.

Chintan