You are viewing limited content. For full access, please sign in.

Question

Question

how to copy one field value from another field in same form.

asked on March 9, 2017 Show version history

hi,

We have one requirement , Where we have two drop down fields populated through lookups, one of them will be selected by the user based on radio button conditions. what we want is selected value from Either of these dropdown field will be Copied to Another single line fields. 

Pls suggest how to achieve this by Scripting.

Looking forward to your suggestion and solution.

Screen shot attached for ref:

Thanks
Sumeet

0 0

Answer

SELECTED ANSWER
replied on March 14, 2017

I modified your form to use two real dropdown instead of two single line with auto suggestion, you can test with single line2, it works now. There is something wrong with single line with auto suggestion, please use dropdown field instead.

0 0

Replies

replied on March 10, 2017

If you are using Forms 10.0 or greater, you can just go into the Single Line Field, open the Advanced tab, and in the Calculations field put =DropDown Field Variable as you would in excel. In the case where a decision is being made about whether to copy the value from DropDown 1 or 2, the field can also have an If statement similar to what you would choose in excel.

1 0
replied on March 11, 2017

hi Steve, 

i have tried with Excel formula. but its Selecting one condition at a time.

IF(Drop-Down1<>"",Drop-Down1,IF(Drop-Down2<>"",Drop-Down2)) 

Pls suggest.

0 0
replied on March 12, 2017

You can try following two calculations:

=IF(Drop_down1<>"",Drop_down1,Drop_down2)

or

=IF(Drop_down1<>"",Drop_down1,IF(Drop_down2<>"",Drop_down2,Drop_down1))

0 0
replied on March 13, 2017 Show version history

Dear Xiang,

 

I have tested both the formula. Condition 1 is working. Condition 2 on  not working. it is not picking the condition 2 drop down value in single line.

Please suggest

 

 

 

0 0
replied on March 13, 2017 Show version history

It should because when dropdown1 is hidden, it still has value selected. You can add following custom JavaScript to your form to reset the dropdown value to empty when it is hidden:

$(document).ready(function(){ 
$('.radiobutton input').on('change',function(){
    if( $(this).val()=='Condition1'){
       $(".dropdown2 input").val('').change();
    };
    if($(this).val()=='Condition2'){
      $(".dropdown1 input").val('').change();
                  };
  });
  });

radiobutton, dropdown1, dropdown2 are the CSS class added to the corresponding fields in the field properties  Advanced tab.

0 0
replied on March 14, 2017

Dear xiang,

as suggested on above, i have done the CSS and javascript update in the form. but still it picking on condition 1 values. if you want to have look . you can go through the below link.

form name - field Merging

Username - test

Pwd -123.

http://180.179.207.28/Forms/test 

 

Thanks

sumeet

 

0 0
replied on March 14, 2017 Show version history

I changed the original script based on your form, please use the updated one to replace the old one.

0 0
replied on March 14, 2017

As suggest i have update the script. but still Condition 2 value is not populating singe line field.

0 0
replied on March 14, 2017

Can you share your calculation set for single line ? The script works as expected now.

0 0
replied on March 14, 2017

=IF(APCER_Trainings<>"",APCER_Trainings,IF(CLIENT_Trainings<>"",CLIENT_Trainings,APCER_Trainings))

 

0 0
SELECTED ANSWER
replied on March 14, 2017

I modified your form to use two real dropdown instead of two single line with auto suggestion, you can test with single line2, it works now. There is something wrong with single line with auto suggestion, please use dropdown field instead.

0 0
replied on March 14, 2017

dear Xiang, Thanks for your support.

0 0
replied on March 16, 2017

Xiuhong Xiang - this is something I have been trying to do, also, and I created the exact same dropdown as discussed here, with the same results, the single line field remains empty.  What is it that you changed on Sumeet Jain's form that made it work?

Thanks, Connie Prendergast, Flagstaff County

0 0
replied on May 3, 2017

I just changed the fields from single line type to dropdown type, to make it works. And the issue for single line type field has been fixed in the coming Forms 10.2.1.

0 0
replied on January 29, 2018

I am trying to figure out what you did to make this work as well. When I change the single line field in this example, I do not have a calculations option to add the IF statement. Can you please advise?

0 0
replied on February 1, 2018

I figured this out. Had to include the equal sign before the excel type expression.

=if(condition,valueIfTrue,valueIfFalse)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.