CMS Development

jesusgonzalez20
メンバー

change value of input depending of the select option

解決

 

hbspt.forms.create({
          portalId: "ID",
          formId: "IDFORM",
          css: '',
          submitButtonClass: 'botonformu',
          cssClass: 'probandoformu',
          onFormReady: function onFormReady($form, ctx) {
            var pais =  document.getElementById('idselect');
            var telf = document.getElementById('idinputphone');
            
            //$('select[name="probandochange"] > option[value="+52"]').prop("selected", "selected").change();
           // $('input[name="phone"]').val('+52').change();
            

            pais.onchange = function(e) {
		          telf.val = this.val;
              console.log( telf.value = this.value);
            }

  }
        });

Hi everybody.

I'm trying to create a form where change of the value of input(phone) depending of the select option. In another words, for example if the user choose the country Mexico, the input show the lada of that country and and so on and so on.

Something like that?

https://jsfiddle.net/em2wjhqh/4/

can anybody help me?

 

2件の承認済みベストアンサー
sharonlicari
解決策
コミュニティーマネージャー
コミュニティーマネージャー

change value of input depending of the select option

解決

Hey @jesusgonzalez20 

 

Thanks for reaching out! I want to tag in some subject matter experts to get their insight on this situation.

 

@dennisedson @Anton @Jsum  do you have any suggestions for @jesusgonzalez20 ?

 

Thanks,

Sharon


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




元の投稿で解決策を見る

0 いいね!
Anton
解決策
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

change value of input depending of the select option

解決

Hi @jesusgonzalez20

it's easier than you think 🙂 

 

If you'll add a phone number field to the form you'll have a checkbox for "show country code dropdown". Check it and it will automaticly set everything up

 

Bildschirmfoto 2020-05-02 um 13.06.51.png

 

 

Hope this helps

 

 

best, 

Anton

Anton Bujanowski Signature

元の投稿で解決策を見る

3件の返信
Anton
解決策
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

change value of input depending of the select option

解決

Hi @jesusgonzalez20

it's easier than you think 🙂 

 

If you'll add a phone number field to the form you'll have a checkbox for "show country code dropdown". Check it and it will automaticly set everything up

 

Bildschirmfoto 2020-05-02 um 13.06.51.png

 

 

Hope this helps

 

 

best, 

Anton

Anton Bujanowski Signature
jesusgonzalez20
メンバー

change value of input depending of the select option

解決

Thanks, it works スマイリー ハッピー

sharonlicari
解決策
コミュニティーマネージャー
コミュニティーマネージャー

change value of input depending of the select option

解決

Hey @jesusgonzalez20 

 

Thanks for reaching out! I want to tag in some subject matter experts to get their insight on this situation.

 

@dennisedson @Anton @Jsum  do you have any suggestions for @jesusgonzalez20 ?

 

Thanks,

Sharon


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 いいね!