Jezza22 Posted March 13, 2009 Share Posted March 13, 2009 Ok Here is my problem... I need to submit a form from a button, and the button is created within Java. My problem is, I need the button to post a value using $_GET or $_POST back to the form. The java script the creates the button is: - var b1 = new AW.UI.Button; b1.setId("button1"); b1.setControlText("Button 1"); b1.setControlImage("key"); b1.refresh(); b1.onControlClicked = function(){ document.Customer.submit(); } And the form is using the <Span> tag to display the button as follows: - <span id="button1"></span> How I can set a $_GET or $_POST value, within the javascript or <Span> tags, to be posted back to the form? Quote Link to comment Share on other sites More sharing options...
Floydian Posted March 13, 2009 Share Posted March 13, 2009 one method, out of many many methods would be to dynamically generate a hidden input var hiddenInput = document.createElement('input'); hiddenInput.setAttribute('type', hidden); hiddenInput.value= YOUR GET VALUE; // insert into the form document.Customer.appendChild(hiddenInput); This may not be the most browser compliant way, IE inparticular might not like this. So, you might need to already have an input on the page, or make an input as a text string and insert it using innerHTML Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted March 19, 2009 Share Posted March 19, 2009 form from a button, and the button is created within Java. First this JavaScript!=Java what your script is doing var b1 = new AW.UI.Button; b1.setId("button1"); b1.setControlText("Button 1"); b1.setControlImage("key"); b1.refresh(); b1.onControlClicked = function(){ do is dynamicly changing your html within your browser. A neat tool i use is firebug for firefox to see how javascript changes the html. Simply using "view source" will only show the html the first time the page loads. With firebug you can see what changes dynamicly. I suggest you try. also you can just put the get vars using links like so <a href="sompage.php?getvar=myvalue">somepage</a> in this example you have the $_GET['getvar'] with the value "myvalue" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.