paulmo Posted October 18, 2010 Share Posted October 18, 2010 Again referring to YUI Menu Button: I need to use selected values, but you'll notice there are neither "id" tags in JS code nor option select fields like in a markup form, so I don't see how I'll use getElementById. I need to be able to use the values from both buttons, "size" and "temperament" to give a response back to user. How to do this? I'm not even sure my Submit button is working the way it would in a markup form, given that the JS rendered Menu button is really not in the form to begin with. Please help. <script>// Search for an element to place the Menu Button into via the // Event utility's "onContentReady" methodYAHOO.util.Event.onContentReady("size", function () { // "click" event handler for each item in the Button's menu var onMenuItemClick = function (p_sType, p_aArgs, p_oItem) { var sText = p_oItem.cfg.getProperty("text"); YAHOO.log("[MenuItem Properties] text: " + sText + ", value: " + p_oItem.value); oMenuButton1.set("label", sText); }; // Create an array of YAHOO.widget.MenuItem configuration properties var aMenuButton1Menu = [ { text: "Small < 30 lbs.", value: 1, onclick: { fn: onMenuItemClick } }, { text: "Medium < 65 lbs.", value: 2, onclick: { fn: onMenuItemClick } }, { text: "Large > 65 lbs.", value: 3, onclick: { fn: onMenuItemClick } } ]; // Instantiate a Menu Button using the array of YAHOO.widget.MenuItem // configuration properties as the value for the "menu" // configuration attribute. var oMenuButton1 = new YAHOO.widget.Button({ type: "menu", label: "Size", name: "menu1", menu: aMenuButton1Menu, container: this });}); </script> and form with submit button: <form name="trait" method="post"><div id="submit"><input id="submitbutton1" type="submit" name="submitfield1" value="Process"></div>//note these refer to JS rendered button, so not really sure what good they're doing in form; values will have to come from the previous JS (above)<div id="temperament"><div id="size"></form><script>var oSubmitButton1 = new YAHOO.widget.Button("submitbutton1", { value: "submitbutton1value" });</script> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.