NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Rene Simons on January 04, 2019, 03:07:27 AM
-
Hi,
I have created a select droplist per browse row.
When a value is selected, I want the server to do a location.href, depending on the value selected in the droplist.
It seems however that my onchange is "outsmarted" by the rowclicked event.
The select is written as:
<select id="1" name="?h=DXG0E0I8b5pfebx1MTxPuROi1W6mFLfa&m=Q&s=@J9DCSONCD" class="nt-browse-entry" style="width:" onchange="location_href(this)">
<option value="" selected="selected" class="nt-browse-entry">Pick option</option>
<option value="2" class="nt-browse-entry">Change</option>
<option value="5" class="nt-browse-entry">Display</option>
</select>
The html for the <select></select> is constructed and pasted in the browse as XHTML. (looks great!)
The JS part is written as:
function location_href(e) {
//console.log(e);
// debugger;
var myUrl;
myUrl = 'localhost:88/screen01' + e.name + '&t=opt&opt=' + e.value + '&sfr=' + e.id;
location.href = myUrl;
};
CopyAll and GzipAll are done.
I really need this functionality.
What can I do?
Cheers,
Rene Simons
-
my guess is that you're on the wrong track.
>> It seems however that my onchange is "outsmarted" by the rowclicked event.
This seems unlikely. You will get an onclick at the server, yes, but the onChange will also fire.
your console.log call in location_href will likely be cleared almost immediately by the new page load. Perhaps in this case I'd start with;
<select id="1" name="?h=DXG0E0I8b5pfebx1MTxPuROi1W6mFLfa&m=Q&s=@J9DCSONCD" class="nt-browse-entry" style="width:" onchange="alert(123)">
and see if you see the alert box. Then move on from there...
Cheers
Bruce
-
Bruce,
Thanks.
First I built the URL in the javascript function and used an alert to have a look at it.
I found out that the URL, produced in the location_href javascript function was escaped and therefore not workable for the server.
After unescape(MyUrl) things look much better. I even get a response from the iSeries.
On to the next hurdle ;)
Cheers,
Ren?