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!

function trigger question?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
Hi guys,
I see you're all still providing excellent guidance here so I thought I would ask for some again.

I have several html pages that rely on javascript functions to build dynamic select content AND control the display of certain fields using the hide/inline attributes. They work fine except I'm having issues with one of the functions NOT being triggered.

On a select list I'm using an onChange trigger and this works just fine on the current page. Then when the user submits the current page and I redisplay the previous page with the embedded select I use an onLoad on the body tag. I pass a parameter to the referenced function to be used as an argument to determine which function(s) to be called/executed. Firebug shows the functions being called, the values passed correctly and I see no errors but one of the function's results don't seem to work.

Here's a snippet of the page's body tag:
<body onload="onLoadfunction('$_fld1', '$_fld2','$_fld3','$_fld4','$_fld5');">

And the called function:
function onLoadfunction(fld1, fld2, fld3, fld4, fld5) {
if (fld1 <= '2') { getList(fld2, fld3, fld4, fld5); }
if (fld1 >= '2') { getInfo(fld3, fld4, fld5); }

As you can see the first field passed to the <body> tag if is set to a '2' then BOTH other functions should be called passing the corresponding parameters.
Of course the function and fields names have been changed to protect the innocent (grin).

Perhaps this sounds wonky but I can't think of any other method to accomplish this need. So if anyone has any suggestions as to an alternate way, I sure would appreciate hearing it.

Thanks again and I look forward to all your responses.





 
perhaps post the 'real' code or point us to a public web page.

is there any reason why you are numerically comparing strings rather than numbers?

 
If the functions are being correctly called, then it stands to reason there's something inside the function that is not running correctly that is at fault.

What is supposed to happen?

What is happening instead?

Are you getting any JS errors? Firefox's error console should show you any errors you may be getting.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top