:: Forum >>

Newbie - How do I retrieve input variables in the next page

In HTML I use a simple <input> statement within a form-

<input name="userID" type="text">

after I submit and post, in the following page I use PHP to obtain the value of the input using a $_POST['userID'] statement

In AW I am using the follwing AW.UI.Input statetment -

var userID = new AW.UI.Input;
input_userID.setId("userID");
document.write(userID);

in the same form - and after I submit an post I am unable to get the variables in the following page.

Any suggestions?
Jerry
Friday, February 29, 2008
The html form integration is partially implemented in AW 2.5.1. It is not complete yet, and because of that it is not yet in changelog and documentation (use at your own risk).

Currently all AW controls have setName() method which adds <input type="hidden"> form element to the control with the given name attribute. The name can be the same or different from the control id - they are not related.

The value attribute is linked to the controlData property, which is calculated from the controlValue using controlFormat.

Currently this logic works for single item controls (textbox, checkbox) but for list and grid controls you have to specify yourself, which information goes into 'form value' (i.e. controlData property).

Here is a sample code -

<form id="myForm">
    <span id="input"></span>
    <span id="checkbox"></span>
    <span id="submit"></span>
</form>

<script>

var input = new AW.UI.Input;
input.setId("input");
input.setName("input");
input.setControlText("Input");
input.refresh();

var checkbox = new AW.UI.Checkbox;
checkbox.setId("checkbox");
checkbox.setName("checkbox");
checkbox.setControlText("checkbox");
checkbox.refresh();

var button = new AW.UI.Button;
button.setId("submit");
button.setControlText("Submit");
button.refresh();

button.onClick = function(){
    document.forms.myForm.submit();
}

</script>


Name and id could be different. Id is used to find an element inside html page and name is an http parameter name.
Alex (ActiveWidgets)
Friday, February 29, 2008
Great - thanks. Now, where do I get the hidden documentation??? :)
Jerry
Friday, February 29, 2008

This topic is archived.


Back to support forum

Forum search