3.2.0

problem in passing row value to textfield input

i made this function to pass the row value of the grid to the text input

obj.setAction("click", function(src)
{
var row = src.getRowProperty("index");
var count = this.getColumnProperty("count");
var column, result = [];
for (column = 0; column < count; column++)
{
result.push(this.getDataProperty("text", row, column));
}
//alert (result[1]);
document.form.textfield1.value = result[1];
}

the 'alert' gave me the result
but the script keep giving me error msg : "document.form.textfield1 is null or not an object" (of course, there is the object cause i name the input text with "textfield1")
for the grid, i use the xml data
can you help me please?

thx in advance
andra
April 7,
Try document.forms['<form_name>'].textfield1.value=result[1]; or
document.'<form_name>'.textfield1.value=result[1];
Plastik
April 7,
it doesn't work
the first one gives me error msg: "document.forms.form.textfield1 is null or not an object" and the second one gives me error msg :"expected identifier"

i used php to generate my xml data, and it works, the table could be shown
here is my full code, i really appreciate if you can check my code, thx

<form name="form">
<input type="text" name="textfield1" size="10">
<!--generate the XML table-->
<textarea id="grid1" wrap="off" style="HEIGHT:100px" target="height:220px">

//getting the data from php
var table = new Active.XML.Table;
table.setProperty("URL", "http://127.0.0.1/soap/wb_userdata.php?query=<?=$userquery?>");
table.request();

var obj = new Active.Controls.Grid;
var columns = ["ID", "FIRST NAME", "MIDDLE NAME", "LAST NAME", "DESIGNATION", "EMPLOYEE NUMBER"];

obj.setColumnProperty("texts", columns);
obj.setModel("data", table);

//this is the function
obj.setAction("click", function(src)
{
var row = src.getRowProperty("index");
var count = this.getColumnProperty("count");
var column, result = [];
for (column = 0; column < count; column++)
{
result.push(this.getDataProperty("text", row, column));
}
//the problem start here !!
//return (result);
document.forms['form'].textfield1.value=result[1];
//document.form.textfield1.value = result[1];
}
);

document.write(obj);
</textarea>
<script>if(window.site) site.example("grid1",510);</script>

to execute the script in the textarea i use the function below, as declare in the site.js (in the activewidget example)
here is the function :
site.example = function(source,size){
try {
var text = document.getElementById(source).value;
var style = document.getElementById(source).getAttribute("target");
var b = "<button style=\"position:relative;left:-60px;top:8px;margin-bottom:-22px;font-size:11px;line-height:11px;height:22px;width:50px\"";
b += " title=\"This example is live! Try to modify the script in the textbox and press 'refresh' to see the results.\"";
b += " onclick=\"window.refresh" + source + "()\">Refresh</button><br />";
document.write(b);

var name = source + "-frame";
var f = "<iframe name='" + name + "' width='" + size +"' style='" + style +"' frameborder=\"0\"></iframe>";
document.write(f);

var doc = frames[name].document;
doc.open();
doc.write("<html><head>");
doc.write("</head><body>");
doc.write("</body></html>");
doc.close()

var wl = window.onload;
window.onload = window["refresh" + source] = function(){
if (typeof wl == "function" ) {wl()}
var doc = frames[name].document;
doc.open();
doc.write("<html><head>");
doc.write("<style> body, html {margin:0px; padding: 0px; overflow: hidden; font: menu} </style>");
doc.write("<link href=\"../include/runtime/styles/classic/grid.css\" rel=\"stylesheet\" type=\"text/css\" ></link>");
doc.write("<style>.active-row-highlight .active-row-cell {background-color: threedshadow}</style>");
doc.write("<s" + "cript src=\"../include/runtime/lib/grid.js\"></s" + "cript>");
doc.write("</head><body>");
doc.write("<s" + "cript>" + document.getElementById(source).value + "</s" + "cript>");

window.setTimeout(function(){
doc.write("</body></html>");
doc.close()
}, 1000);

}

}
catch(e){
}
}
andra
April 8,

try this ...

obj.setAction("click", function(src){ window.text1.value =

window.text1.value = src.getDataProperty("text",2)
});

note :
' 2 - column index
- Cha
Cha
June 17,
hi,
i'm very new to Active Widgets. can any one help me, how to create a Combo Box using Active Widgets

regards
arun
arun
June 23,

This topic is archived.

See also:


Back to support forum