 |
|
| Problem |
Solution |
| Using a javascript array of keyfields that match input criteria |
The key fields can then be counted and "scrolled through" on the web page like this: |
|
|
therow integer := 0;
htp.p('
< Script language=JavaScript >
newopt = new Array;');
for rec in (select keyfield from TABLE
where ...) loop
htp.p('newopt['||therow||']="'||rec.keyfield||'";');
therow := therow + 1;
end loop;
//
// move thro' javascript array of keyfields
// therec is the record required (> stops overrun)
//
function gorec(newrec,therec) {
if (newrec == "1" && '||therow||' > therec) {
jumprec = new Number(therec);
jumprec = jumprec + 1;
top.body.location=
"PACKAGE.PROCEDURE?therow="+newopt[jumprec];
}
}
|
| Setting a select option to a specific value |
In this example the specific value is a cursor value and is used like this: |
|
|
for (var i = 0; i < document.form.field.length; i++) {
if (document.form.field.options[i].value
== "'||rec.field||'") {
var ino=document.form.field.options[i].index
}
}
document.form.field.options[ino].selected=true;
|
| Setting a check boxes value |
In this example the flag checkboxes value is kept in step with the "checked" attribute like this: |
|
|
<INPUT TYPE="Checkbox" NAME="flag"
checked value="Y"
onClick="if (this.checked) {this.value = 'Y';}
else {this.value = 'N';}">
|