473,383 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

find values of text field without using a form

I have reason to use a text field outside of a <formtag, but I'm
having trouble checking the value of the form. The idea is to grab the
field value and append it to a redirect.

The problem is I can't get the field value. Here's the code I'm trying
to use:

in my .aspx page:
<td width="140"><input type="text" name="searchString"
id="SearchString" class="smallFont" style="width: 135px;" /></td>
<td width="25" align="right"><input type="image" name="searchButton"
id="searchButton" src="/_images/goButton.gif" onclick="submitSearch()"
/></td>

in my .js file:

function submitSearch() {
alert(document.getElementById('searchString').valu e);
}

When i click the searchButton image, I get the following javascript
error:
Error: document.getElementById("searchString") has no properties

any ideas?? I've checked multiple websites and believe this is the
right method of doing this, but well.. I get the error.

Jul 24 '06 #1
2 1826


Kevin Blount wrote:

<td width="140"><input type="text" name="searchString"
id="SearchString" class="smallFont" style="width: 135px;" /></td>
^^^^^^^^^^^^
If the id is "SearchString" then you need to pass exactly that to
alert(document.getElementById('searchString').valu e);
getElementById, but you pass in "searchString".

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 24 '06 #2
Thanks Martin. Tis was a case of looking at it too long. I know that
JavaScript (and C#.NET which I'm also writing in) is case sensitive...
I just didn't even spot that I had an upper S for the ID.. it's weird,
as I never start field names/IDs with upper case letters, so I guess I
didn't think of looking at this one, especially as "name" is the
correct case.

cheers :)

Kevin

Martin Honnen wrote:
Kevin Blount wrote:

<td width="140"><input type="text" name="searchString"
id="SearchString" class="smallFont" style="width: 135px;" /></td>
^^^^^^^^^^^^
If the id is "SearchString" then you need to pass exactly that to
alert(document.getElementById('searchString').valu e);

getElementById, but you pass in "searchString".

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
1
by: Eskil | last post by:
Hi I have a form that supplies my query with information on two different variables. The form uses a lookup to display a list of 5 different customer types and 5 different types of...
11
by: Pete | last post by:
Is there any way to change the default search to "Any Part Of Field" instead of whole field? The first thing I ever do when searching for something in a field is change the default setting from...
3
by: User | last post by:
Form A (Main) Text Box 1 Text Box 2 Text Box 3 Form B (Pop-up) Choose a selection for Form A/Text Box 3 Scenario:
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
7
by: Nemisis | last post by:
Hi everyone, Can anyone tell me if it is possible to pass in a property of an object into a sub, and within that sub, find out the name of the item that was passed along with the property name??...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
8
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.