B C
B C

Reputation: 11

Copy value from picklist to text field before saving?

I use formstack, an application where I can create forms for Salesforce.

I have a form with two fields:

  1. Province_pick (this is a picklist field)
  2. Province_text (this is a text field)

I want to make sure that people chose a value from Province_pick and once they submit/save the form, the value from Province_pick gets copied to Province_text. Now I'm no developer but I have been googeling and testing multiple variations.

Could anyone help me out here?

This is what I got so far:

function FF_OnBeforeSave() {
var box1 = document.getElementById('Province_pick');
var box2 = document.getElementById('Province_text');
box2.value = box1.value;

I have also tried this one:

   $(document).ready(function () {

       function FF_OnBeforeSave() {
           //Since you have JQuery, why aren't you using it?
           var box1 = $('#Province_Pick');
           var box2 = $('#Province_Text');
           box2.val(box1.val());
       }
       $('#Province_Text').on('change', onchange);
   });

Hopefully somebody could help me out here. Appreciate it!

Regards

Upvotes: 1

Views: 249

Answers (0)

Related Questions