how many times can you spot the letter "y" in:
q: dynamic select option in remote objects visualforce. this page is not record-specific the question is in the code comments.  thank you!
<apex:page>
<apex:remoteobjects >
<apex:remoteobjectmodel jsshorthand="js" name="mycustomobject__c" fields="id">
<apex:remoteobjectfield name="custom_field__c">
</apex:remoteobjectfield>
</apex:remoteobjectmodel>
</apex:remoteobjects>
<div id="dynamicselectioncontainer">
<!--
this page is intentionally not record-specific.
how would i create a html select list where 
each select option is labeled after the recordtype.name of schema.sobjecttype.mycustomobject__c? 
i also need recordtype.id to be jquery-accessible, i think as an attribute.
in other words how would i dynamically create 
the html <select> <option> markup to give me all record types
of  schema.sobjecttype.mycustomobject__c.  
example: select id,name from recordtype where sobjecttype='mycustomobject__c'
-->
</div>
</apex:page>


a: you can use remoting for this purpose. here's a generic page that loads the record types for account (replace with your desired object):
<apex:page >
    <apex:remoteobjects jsnamespace="remotens">
        <apex:remoteobjectmodel name="recordtype" fields="sobjecttype,name,developername,id" />
    </apex:remoteobjects>
    <script>
    var rt = new remotens.recordtype();
    rt.retrieve({ where: { sobjecttype: { eq: "account" } } }, function(error, result) {
        result.foreach(function(value){
            var options = document.getelementbyid("recordtypeoptions");
            var option = document.createelement("option");
            console.log(value);
            option.text = value.get('name');
            option.value = value.get('id');
            options.appendchild(option);
       }); 
    });
    </script>
    <select id="recordtypeoptions">

    </select>
</apex:page>


user
The total number of "y"s in that passage is 28.
assistant