CMS Development

amandablum
Member

How do I find the values of property options?

Should be pretty simple, sure I'm missing it somewhere. I can pull the internal value of a property name, but not of the individual options for that property. Obviously, I can see the labels, but programatically should be using the values instead.  (Going to run a conditional on thank you pages based on option selection). 

 

Please place a giant flashing red light over it so this **bleep** can find it. Thank you! 

0 Upvotes
7 Replies 7
amandablum
Member

How do I find the values of property options?

@Anton  @dennisedson  ?

 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

How do I find the values of property options?

@amandablum 

Mind showing the code you have so far? 

0 Upvotes
amandablum
Member

How do I find the values of property options?

hbspt.forms.create({
region: "na1",
portalId: "20779338",
formId: "5710158a-26f1-4f7d-a440-7f03c92c149d",
  onFormSubmit: function($form) {
    var langneeds = $form.find('select[name="language_needs__c"]').val();

    setTimeout( function() {
      if ( langneeds == "Document Translation" ) {
        window.location.href = "https://google/a";
      }>       if ( langneeds == "Telephone Interpreting" ) {
        window.location.href = "https://google/b";
      }       if ( langneeds == "Video Remote Interpreting" ) {
        window.location.href = "https://google/b";
      }      if ( langneeds == "Assessment_Services" ) {
        window.location.href = "https://google/b";
      }


    }, 500 ); // Waits 1/2 second to redirect.
  }
});

0 Upvotes
amandablum
Member

How do I find the values of property options?

Just want to add.. I can see "internal value" but am suprised it doesn't default to underscores and lowercase. Am I just ignoring the obvious? 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

How do I find the values of property options?

You should be getting the actual internal value (no spaces)

The form you have above is missing the select input 🤔

I did a mock up with a select and using onformready instead of submit to demonstrate that you should be getting internal values with _

You should see it returned in the console

0 Upvotes
amandablum
Member

How do I find the values of property options?

The select input is generated by the hubspot form itself. This is an embedded form event on an embedded form in a webpage. It should just check the field with the value language_needs_c and if Document translation send them to google/a else send them to google/b.  I'm leaving multiple if statements in, just in case we decide to vary this in the future.

But this doesn't really answer my original question which is how does one obtain the actual internal value, which agreed, shouldn't have spaces or caps? 

 

 

 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

How do I find the values of property options?

@amandablum 

Do you have a page with this form on it?  I embedded your form on a page and I never saw the select.  You can dm me if you do not want to share publicly

0 Upvotes