CMS Development

jesusgonzalez20
Membro

change value of input depending of the select option

resolver

 

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 Solução aceitas
sharonlicari
Solução
Gerente da Comunidade
Gerente da Comunidade

change value of input depending of the select option

resolver

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 !




Exibir solução no post original

0 Avaliação positiva
Anton
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

change value of input depending of the select option

resolver

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

Exibir solução no post original

3 Respostas 3
Anton
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

change value of input depending of the select option

resolver

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
Membro

change value of input depending of the select option

resolver

Thanks, it works Smiley feliz

sharonlicari
Solução
Gerente da Comunidade
Gerente da Comunidade

change value of input depending of the select option

resolver

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 Avaliação positiva