CMS Development

jesusgonzalez20
Mitglied

change value of input depending of the select option

lösung

 

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 Akzeptierte Lösungen
sharonlicari
Lösung
Community-Manager/-in
Community-Manager/-in

change value of input depending of the select option

lösung

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 !




Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
Anton
Lösung
Trendsetter/-in | Diamond Partner
Trendsetter/-in | Diamond Partner

change value of input depending of the select option

lösung

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

Lösung in ursprünglichem Beitrag anzeigen

3 Antworten
Anton
Lösung
Trendsetter/-in | Diamond Partner
Trendsetter/-in | Diamond Partner

change value of input depending of the select option

lösung

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
Mitglied

change value of input depending of the select option

lösung

Thanks, it works Smiley (fröhlich)

sharonlicari
Lösung
Community-Manager/-in
Community-Manager/-in

change value of input depending of the select option

lösung

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 Upvotes