NetTalk Central

Author Topic: Droplist onchange not firing because _event_=rowclicked prevails? WHAT CAN I DO?  (Read 4385 times)

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
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


Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
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

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
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?

Rene Simons
NT14.14