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!

InnerHTML - function with elementId help

Status
Not open for further replies.

tc3596

Technical User
Mar 16, 2001
283
I am knew to javascript, so I hope this question doesn't seem too novice. Basically a user types in a customer number and I need to populate a customer name.

I have a built in function that will do the lookup when you pass it the table, field and where claus. Here is the line of code...

document.getElementById('cus_name_value').innerHTML = '<%=Trim(""&GetField("vwBrowser_Company", "WHERE CustomerNo = ' + document.frmMain.cus_no.value + '", "CustomerName")) %>';

If I take out the ' + document.frmMain.cus_no.value + ' piece and replace it with a real value like 000000000883, it all works fine. I get back the correct cust name and the input field gets populated correctly. I am sure I am missing an apostrophe or something simple. Just an fyi...I do an alert(document.frmMain.cus_no.value); right before this and it sends back 000000000883 as expected.

Thanks.

 
If I'm not totally wrong here, you shouldn't mess up with server-side and client-side scripting!

JavaScript is client side which is executed in the clients browser after it received the page from the server.
But It looks like, that you also use some server side stuff in it (starting with the <%) which is interpreted on server side before it is send to the browser.

So at the moment you try to populate your server side script part with a value with a client side result which doesen't happend already.

Well, I'm not that expert in that area so I can't give good advices how to resolve that right now, but my first guess would be to take a look at AJAX to combine JS and server side scripting.

I hope somebody else can give some better advice ;)
 
you are correct.. i did solve this using ajax. Learned alot. Thanks for your reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top