Jump to content

Submit $_GET Value


Jezza22

Recommended Posts

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?

 

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.