473,587 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving view to start of text field

2 New Member
I'm having trouble with some javascript functionality.

I have a text input that can hold more characters than it can show. When the focus leaves the text field I have to show the start of the string again, instead of the end that they just typed in. I've been able to get this functionality to work in firefox, but not IE. The only thing I found that almost worked was using ranges and selecting elements 0 to 0. However, I'm doing this function in an onBlur action, so this will never leave the text box

Any ideas on how to view the start of a start of a string in a text field in an onBlur action?
Sep 10 '07 #1
5 1302
gits
5,390 Recognized Expert Moderator Expert
hi ...

welcome to TSDN ...

have a look at the following example ... may be it helps :)

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function do_blur(obj) {
  3.     obj.value = obj.value;
  4. }
  5. </script>
  6.  
  7. <input type="text" name="test" onblur="do_blur(this);"/>
  8.  
kind regards
Sep 10 '07 #2
iam_clint
1,208 Recognized Expert Top Contributor
This is a piece of sample code i made for ya give it a go (works in firefox and IE)
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <script>
  3. var oldval = "";
  4. var objid;
  5. function moveStart(obj) {
  6.         oldval = obj.value;
  7.         obj.value = "";
  8.         objid = obj.id
  9.         window.setTimeout("resetVal();", 10);
  10. }
  11. function resetVal() {
  12.     document.getElementById(objid).value = oldval;
  13. }
  14. </script>
  15. <body>
  16. <input type="text" id="test" onblur="moveStart(this);">
  17. <input type="text" id="test1" onblur="moveStart(this);">
  18. <input type="text" id="test2" onblur="moveStart(this);">
  19. <input type="text" id="test3" onblur="moveStart(this);">
  20. </body>
  21. </html>
  22.  
Gits your version didn't work in IE for me because there was no delay between resetting the value.
Sep 10 '07 #3
gits
5,390 Recognized Expert Moderator Expert
heya iam_clint,

well ... you are certainly right ;) ... since i have no IE at home i cannot test it ... but the simple idea was to assign the same value to the field as the one thats actually typed in there ... and to avoid that selection and range operations which seems to be really obsolete here :) ... thank you for proofing and improving the idea ...

kind regards
Sep 10 '07 #4
horse21
2 New Member
Ah, thank you. The first post is what I was doing in firefox, and I figured that it wasn't working in IE because it was the same value... for some reason I didn't think to clear it out first. Not at my development computer right now, but I'm sure it will work. Thanks again!
Sep 11 '07 #5
gits
5,390 Recognized Expert Moderator Expert
hi ...

no problem ... we are glad to help you ...post back to the forum anytime you have more questions ...

kind regards
Sep 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4809
by: ghanley | last post by:
Hi Guys, I need some help with a problem related to the looping through a recordset to display on a tree view control. My table has no Primary key - because duplicates are allowed. ID parent 1 2 1
2
3370
by: Ted | last post by:
Hello all. Its been a few years since I've been here. I hope everyone is well. I am working on a report that has several sub reports in the detail section. I have sized the sub reports to have the smallest height possible in design view. I have set their can grow property to true so if they have data they will grow vertically as needed. ...
3
1440
by: aljodo | last post by:
ASP.Net v1.1 & vb.net Hi all, I have a simple survey form with first name/last name text boxes at the top. I have validators on these text boxes to ensure that something is entered in them. The form has a Submit button (asp:button) at the bottom and if the validation has failed I want the form to return to the top, so that the
6
4899
by: Matt | last post by:
I'm not entirely sure how to describe this issue. I have a number of ComboBoxes in my application which have their text properties bound to a field in a data set. The items loaded in the ComboBox are not data bound (they just use the built in collection property of the ComboBox), and they are all set to use the DropDownList style. When moving...
3
3040
by: Mark | last post by:
Is there a way to just move the field values and not the field descriptions within a form in design view? I try to grab just those values and it takes the descriptions with it. Some field names are a bit long and are running into the values. I just want to move the values over a few grids so I can see the description. There has to be a way....
6
2046
by: Bill44077 | last post by:
Hi, I am new to the MVP pattern and one of the main reasons that we are going this route is because we are doing Scrum with 30 day sprints - so we have a continually morphing design. We are using TDD as well to improve our ability to refactor... you probably all know this approach. Although the user iterface is supposedly one of the last...
1
2544
by: Parasyke | last post by:
Thanks in advance... I need to on a subform in datasheet view to be able to, instead of delete a record, move that record to another table. I can if needed turn the subform into a continuous form emulating a datasheet view. Any clues on how to do this? Thanks! ... Dav
0
1416
by: mtsylvester | last post by:
Hi All, How do I add a List Box to a dynamic Details View. I want to replace the check boxes with list boxes. If I try to simply replace the check box with a list box it complains about not being able to convert it to a datacontrol field. Below is a portion of my current code behind. By the way I tried doing dynamic templates and was not able...
0
1913
by: jvitti | last post by:
I recently upgraded from Access 2000 to Access 2007 and I am having trouble with moving the focus from 1 form to another. While doing data entry if a similar claim is found the claim view form will open listing the similar claims. The data entry clerk can view 1 of the claims and by doubling clicking on the claim number some info from the...
0
7918
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.