How can I get a field element id?

  • 1
  • Question
  • Updated 1 year ago
  • In Progress
Hi everyone, completely new to Skuid and trying to do something like the URL below to create an auto-complete feature in a Salesforce layout.

https://smartystreets.com/products/single-address

Done this many times on regular forms, but was able to add in the JavaScript necessary, but now I'm stuck because I don't know how to get the Element ID of the address fields.  Not sure if you can see the image below, but as you can see, it doesn't appear that each field in the layout has an ID.  It has a data-uid, but I'm not sure if/how I can use that to access this particular field.

Trying to do something like this:

var street = document.getElementById('street-address').value ;


Any help would be really appreciated!

Thanks!

Joseph
Photo of Joseph Dindinger

Joseph Dindinger

  • 80 Points 75 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Khamla Phimmachack

Khamla Phimmachack, Official Rep

  • 1,536 Points 1k badge 2x thumb
Hi Joseph,

You might try viewing the Skuid page XML from the composer. There you should be able to see the "uniqueid" for every field.
Photo of vicky singh

vicky singh

  • 240 Points 100 badge 2x thumb
I checked in XML there I didn't found any "uniqueId" for field ,there is only field api as Id but it's doesn't work. 
Photo of Joseph Dindinger

Joseph Dindinger

  • 80 Points 75 badge 2x thumb
Yes, we have given up on this project.  We found a way to somehow find the field by using a CSS class or something, but that didn't give us what we needed because the fields are not inside of a form.  So bummer.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
You can definitely build that url with skuid.

Try just adding a ui-only formula field to your model and using a formula field to build the url out of the component fields.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Joseph,

SmartyStreets supports REST/JSON.  You can setup a data source and submit data to SmartyStreets using a Skuid model.  Your Inline JavaScript can handle the data in a model and update any fields on the Skuid page as needed.

Thanks,

Bill
Photo of Peter Hale

Peter Hale, Employee

  • 330 Points 250 badge 2x thumb
There is a way to do this, but it does require JS and is a bit tricky.  in the JS where you setup smartyStreets, you can "wrap" the fields you want into a form.  Here's a basic example:
     $(".MemberMailingSection").wrap(function() {
            return '';
        });
    
    var liveaddress = $.LiveAddress({
            key: GetSmartyStreetsLicense,
        debug: false,
        target: "US",
        addresses: [{
           id: 'MemberStreetsSetup',
        address1: '.MemberMailingStreet textarea',
        locality: '.MemberMailingCity input',
        administrative_area: '.MemberMailingState input',
        postal_code: '.MemberMailingZip input',
        country: '.MemberMailingCountry input'
        }]
        });

Now, for each field, I added a css class with the names you see.  I know smartystreets likes Ids (#), but this seems to work.  The "MemberMailingSection" is the css class of the column in the field editor.  

Hope this helps.
(Edited)