Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual InterDev and JavaScript

Status
Not open for further replies.

AndyApp

Programmer
Dec 20, 2001
259
GB
I'm trying to get some JavaScript validation done in Visual InterDev on two drop down box DTCs.

I need it so if you select boxA then boxB is set to the first item in the row and vice versa.

I've tried the 'function boxA_onchange()' but it just seems to be ignored, when i've searched the internet everyone puts it in the select box itself.

That's not so easy however owing to how InterDev builds its DD Boxes and if I place HTML boxes on the page I then have a problem getting the values from them as nothing conventional seem to work there either! "Life is like a Ferrari, it goes to fast.
But that's ok, because you can't afford it anyway" - Jim Davis (Garfield)
 
Two things, the client side bit comes later, but first...

You (may) need to 'advise' each drop-down.

In your server side (thisPage_onload) code...

cmbMyCombo.advise 'onchange', 'dummy()'

This causes the HTML generated to include the onchange event. You should add the server side 'dummy()' function - else the HTML may not include the event - the DTC tries to be clever and only include code for which a handler actually exists!

(I don't think you need to 'advise' the onchange event for a combo box - just add a dummy server-side onchange event handler.)

PART 2...

To 'trap' this event on the client, rather than causing a server round-trip, you must include the

function thisPage_onbeforeserverevent(i_sObj, i_sEvent) {
}

If you add this via the script outline, you will need to add in the two parameters - the object name and the event.

You can then add or call your combo-box code as follows:

if (i_sObj == 'boxA' && i_sEvent == 'onchange')
{
//call my boxA function
//...
// now cancel the server round-trip...
thisPage.cancelEvent = true;
}

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top