07-01-2010 12:36 PM
i.e. You have an element such as: <SalesLogix:Currency runat="server" ID="txtSales" ...
From the Javascipt function, I can't seem to use: document.getElementById("txtSales").value...
So any suggestions would be greatly appreciated.
07-02-2010 05:35 AM
If you look at the markup that is rendered out from the Server the ID txtSales will not directly exist. The ID will be changed to some concatanation of nested ids and the like. You can either identify the name and use it in your dom lookup or you can use JQuery and look for the ID that ends with the text txtSales.
07-06-2010 09:19 AM
In the client side coding Master's Series class we cover this in a few ways.
Mark is correct that the client side name of your txtName control will be something based on the containers it is in and the hierarchy will be apparent. .NET 4.0 changes this a bit, so it is better to write code like this (Mark suggested this on a call a few months back and it was integrated into the class, but there are benefits and drawbacks IMO).
The control will be something like this: ctl00_MainContent_ProductDetails_txtName
here is the JS that you would use and following Mark's advice I am using JQuery here. That is why you see the $()...
but that will change with .net 4.0 and another solution is to get the client id from asp.net:
A good explanation of this is here:
The problem with the latter example is that many SalesLogix controls are composite controls. So when you get the clientID of the control it may not be the control that is "in front." In the client side Master's Series class we expose this a bit and show that changing the css using the latter example really changes the control "in back" which results in a slight red highlighting on the top of the control only rather than the whole control. It does look neat, but YMMV.
In either case you have a few options!
07-06-2010 01:44 PM
Thanks guys for both the suggestions. I basically did this in the OnWireEventHandlers():
And then in the Actual function, I did a
document.getElementById using the composite "ctl00$TabControl$"...
Like you said - not the prettiest way, but it does work correctly.
BTW, if either of you has a list of the attributes available with custom SLX controls (i.e. <SalesLogix: Currency>, it would be of great help. My VS2008 intellisense doesn't recognize SLX controls.
07-07-2010 04:31 AM
07-07-2010 01:37 PM
I'll implement Jason's approach of using asp.net to get my values as this seems a lot cleaner. In terms of interleaving, I agree that having a centralized JS file is a much cleaner approach.
My problem is that I don't know how to 'hook' the code into the smart part form object without using the old fashioned Attributes.Add. If you have an example available, I'd much rather follow that approach.