- Screen name: mfisher8
mfisher8's Profile
2 Posts
31 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 18-Jul-2014 08:47 AM
- Forum: Getting Started
Hi All,
Recently I added a script to my page to prevent the user from tabbing through certain textboxes. Here is the script That I wrote: My question is, is this safe? I ask because, I have a text box that is getting the cost of a service for a record, and when I look in my database, the cost has been inserted into all records??? I checked my back end and everything looks fine. Can anyone break this script down and tell me exactly what it is doing? Thank you so much. I put this script together from bits and pieces of info that I found on this site and I want to make sure it is not the root of my current issue.
< script type ="text/javascript">
$(document).ready( function () {
$( '.textbox' ).keydown( function ( event ) {
var keyCode = event .keyCode || event .which;
if (keyCode == 9) {
confirm( 'The Tab key is disabled for this web page, please use your mouse to navigate between textboxes' );
event .preventDefault();
}
});
});
</ script >
- Hi all!
- I have a problem getting my label values into an array. I am filling a ListView with entities from a database. I want to get the name, type, address, city, etc... from each entity and put the location(which is a label with Latitude and Longitude coordinates) into an array. I am trying the function below, it is getting the CenterName, but it is setting all of my vars as the CenterName, instead of the city, state, zip, for all of my entities. My HTML is here too. I just need a little direction on using the .each() because I'm very new to jquery and I am a little confused on how to get the innerHTML from my labels.Thank you.
- function AddData() {
- var myList = $("li");
- locationDB = myList.children();
- var locationAry = [];
- locationDB.each(function (item, element) {// loop through found locations returned from the database
- var tagName = element["id"];
- if (tagName.match("CenterName") == "CenterName") {
- var healthCenterName = element["innerHTML"];
- var typeofCenter = element["innerHTML"];
- var address = element["innerHTML"];
- var city = element["innerHTML"];
- var state = element["innerHTML"];
- var zipCode = element["innerHTML"];
- var phone = element["innerHTML"];
- var url = element["innerHTML"];
- var services = element["innerHTML"];
- var distance = element["innerHTML"];
- var locationid = element["innerHTML"];
- var location = new Microsoft.Maps.Location(parseFloat(element["innerHTML"]), parseFloat($(element["innerHTML"])));
- var description = address + '<br/>' + city + '<br/>' + state + '<br/>' + phone + '<br/>' + url + '<br/>' + distance;
- }
- var content = {};
- //set object element
- content.id = element["id"];
- content.context = element["innerHTML"];
- // push location to array for use in map viewing
- locationAry.push(content);
- // Let microsoft figure out the viewing boundary to contain all the found locations
- viewBoundaries = Microsoft.Maps.LocationRect.fromLocations(locationAry);
- map.setView({ bounds: viewBoundaries });
- var pin1 = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(location));
- pin1.Title = healthCenterName;
- pin1.Description = description;
- Microsoft.Maps.Events.addHandler(pin1, 'click', displayInfobox);
- dataLayer.push(pin1);
- });
- function displayInfobox(e) {
- if (e.targetType == 'pushpin') {
- infobox.setLocation(e.target.getLocation());
- infobox.setOptions({ visible: true, title: e.target.Title, description: e.target.Description });
- }
- }
- <!-- ListView holds locations returned from DB -->
- <asp:ListView ID="healthCenters" runat="server" DataKeyNames="CenterName,LocationID,Lat,Long">
- <LayoutTemplate >
- <ul id="myList">
- <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
- </ul>
- </LayoutTemplate>
- <ItemTemplate >
- <li ><asp:HyperLink CssClass="details" ID="hlCenterName" runat="server" Text='<%# Eval("CenterName") %>' NavigateUrl='<%# Eval("LocationID", "searchResponse.aspx?LocationID={0}") %>' ></asp:HyperLink></li>
- <li style="list-style:none">Type of Center: <asp:Label CssClass="details" ID="lblTypeofCenter" runat="server" Text='<%# Eval("TypeofCenter") %>' /></li>
- <li style="list-style:none"><asp:Label CssClass="details" ID="lblAddress" runat="server" Text='<%# Eval("Address") %>' /></li>
- <li style="list-style:none"><asp:Label CssClass="details" ID="lblCity" runat="server" Text='<%# Eval("City") %>' /> , <asp:Label ID="lblState" runat="server" Text='<%# Eval("State") %>' /></li>
- <li style="list-style:none"><asp:Label CssClass="details" ID="lblZipCode" runat="server" Text='<%# Eval("ZipCode") %>' /></li>
- <li style="list-style:none">Phone:<asp:Label CssClass="details" ID="lblPhoneNumber" runat="server" Text='<%# String.Format("{0:(###) ###-####}",Convert.ToInt64(Eval("PhoneNumber"))) %>' /></li>
- <li style="list-style:none"><asp:HyperLink CssClass="details" ID="webSite" runat="server" NavigateUrl='<%# Eval("Website") %>' Text='<%# Eval("Website") %>'>HyperLink</asp:HyperLink></li>
- <li style="list-style:none">Patient Services: <asp:Label CssClass="details" ID="lblPatientServices" runat="server" Text='<%# Eval("PatientServices") %>' /></li>
- <li style="list-style:none">Distance: <asp:Label CssClass="details" ID="lblRadius" runat="server" Visible="True" Text='<%# String.Format("{0:0.##}", Eval("DistanceMiles")) + " " + "miles." %>' /></li>
- <li style="list-style:none"><asp:Label CssClass="details" ID="lblLocationID" runat="server" Visible="false" Text='<%# Eval("LocationID") %>' /></li>
- <li style="list-style:none"><asp:Label CssClass="details" ID="lblLat" runat="server" Visible="False" Text='<%# Eval("Lat") %>' /><asp:Label ID="lblLng" runat="server" Visible="False" Text='<%# Eval("Long") %>' /></li>
- <br />
- </ItemTemplate>
- </asp:ListView>
- «Prev
- Next »
Moderate user : mfisher8