Would it be possible to update the menu button with the name of the content type in the current selection?

I wrote this code a few years ago for a "Translate" menu where the word "Translate" was translated into the language of the current selection (i.e. selecting "Italian" would make the "Translate" button turn into a "Traduca" button) and picture the Create Content Block's button changing from "Create Content" to "Create Story Content" or something similar.

At the moment I don't know how to modify this code to display the available content types (or get the button's custom name from the Create Content Block's settings form) but I'd be willing to help if this is a feature you'd like to have.

<form name="translateForm" target="_translate" action="http://www.worldlingo.com/wl/translate" method="get">
  <select onchange="document.translateForm.translateButton.value=this.options[this.selectedIndex].id;" name="wl_lp">
    <option value="en-en" id="Translate">English / English</option>
    <option value="en-nl" id="Vertaal">Nederlands / Dutch</option>
    <option value="en-fr" id="Traduisez">Fran&#231;ais / French</option>
    <option value="en-de" id="&#220;bersetzen Sie">Deutsch / German</option>
    <option value="en-el" id="&#924;&#949;&#964;&#945;&#966;&#961;&#940;&#963;&#964;&#949;">&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940; / Greek</option>
    <option value="en-it" id="Traduca">Italiano / Italian</option>
    <option value="en-ja" id="&#32763;&#35379;&#12375;&#12394;&#12373;&#12356;">&#26085;&#26412;&#35486; / Japanese</option>
    <option value="en-ko" id="&#48264;&#50669;&#54616;&#49901;&#49884;&#50836;">&#54620;&#44397;&#50612; / Korean</option>
    <option value="en-pt" id="Traduza">Portugu&#234;s / Portuguese</option>
    <option value="en-es" id="Traduzca">Espa&#241;ol / Spanish</option>
    <option value="en-ru" id="&#1055;&#1077;&#1088;&#1077;&#1074;&#1077;&#1076;&#1080;&#1090;&#1077;">&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081; / Russian</option>
    <option value="en-zh_cn" id="&#32763;&#35793;">&#20013;&#25991;(&#31616;&#20307;) / Simplified Chinese</option>
    <option value="en-zh_tw" id="&#32763;&#35695;">&#20013;&#25991;(&#32321;&#20307;) / Traditional Chinese</option>
  </select>

  <input type="submit" value="Translate" id="translateButton">
</form>

Comments

Christefano-oldaccount’s picture

Title: Update "Create Content" button with selected name of content type » Dynamically update "Create Content" button with name of selected content type
douggreen’s picture

Status: Active » Closed (won't fix)

I'm already doing onchange' => 'javascript:submit() I'm not sure why you'd want to do this.

Christefano-oldaccount’s picture

My suggestion only makes sense if we entertain the idea that having an onChange event and a submit button is perhaps a little messy and decide to remove the onChange behavior. I'm guessing this probably won't happen any time soon and that's OK, but this suggestion is related to what I brought up in #189698:

On a psychological level, the presence of the button tells the user that his or her menu selection isn't final until the button is clicked.

Why have a button at all if there's an onClick event? If there's going to be a button at all, why not make it a dynamic element and provide user feedback.

Anyway, I'm especially grateful that you're helping to improve the OG/non-OG content creation interface. Thanks!