Search code examples
fbmlfbjs

How to select an element by name in FBML/FBJS?


i have this form below:

<form fbcontext="65d93ec1624a" id="app23744633048_frmFBNewsletter" action="http://register.stage.creative.com/Api/Facebook/SubscribeNewsletter" method="post"><input type="hidden" value="117533374986109" name="fb_sig_profile"><input type="hidden" value="1" name="fb_sig_is_admin"><input type="hidden" value="PAGE" name="fb_sig_type"><input type="hidden" value="0" name="fb_sig_is_fan"><input type="hidden" value="en_US" name="fb_sig_locale"><input type="hidden" value="1" name="fb_sig_in_new_facebook"><input type="hidden" value="1295493683.2974" name="fb_sig_time"><input type="hidden" value="0" name="fb_sig_added"><input type="hidden" value="sg" name="fb_sig_country"><input type="hidden" value="117533374986109" name="fb_sig_page_id"><input type="hidden" value="1" name="fb_sig_page_added"><input type="hidden" value="d2182fe10890bbfe8002bbdb6b6954ab" name="fb_sig_api_key"><input type="hidden" value="23744633048" name="fb_sig_app_id"><input type="hidden" value="7eaa52ce1dab5341d230cbd6b6bd42a8" name="fb_sig">
    </form>

and i need to retrieve the fb_sig_country. i try the javascript getelementsbyname but that doesn't seems to be supported in FBJS.

i've also try the getchildnodes method but still can't get the value.

<script>
<!--

    var countrycode = document.getElementById('frmFBNewsletter').getChildNodes()[8].getName();
    function changeCountry(frmID){
        var msgdialog = new Dialog();
        msgdialog.showMessage('Error', countrycode); 
    }
-->
</script>

any help would be more appreciated :)


Solution

  • in case anybody was wondering how i resolved this issue, what i found out was that all of these values are actually posted over to the server side when the form submits.

    i can see those values via firebug, thus there was no need for me to manually retrieve those values on the client side :)