473,320 Members | 1,948 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,320 software developers and data experts.

Searching strings for matching text

Hi -

Wondering if anyone knows how to code a function fieldcheck to prevent
users from choosing the same date from dual drop list on my web form
using this include file example;

<option value="none">Scroll through the list to choose a date
<option value="May 11 2004, (Tuesday), 1pm">May 11 2004, (Tuesday),
1pm
<option value="May 11 2004, (Tuesday), 2:30pm">May 11 2004, (Tuesday),
2:30pm

I'd prefer to alert the user (return false) if this string ">May 11
2004, is the same as this string ">May 11 2004, on the next line of
the include file.

I now have this code working nicely to prevent the same choice;

FirstCh=document.laptop.FirstCh.value
SecondCh=document.laptop.SecondCh.value

if (FirstCh == "none" || SecondCh == "none" || FirstCh == SecondCh) {
alert("Please choose two [different] dates/times for your laptop
delivery.")
document.laptop.FirstCh.focus()
return false
}

....but I'd prefer to alert the user (return false) if this string
">May 11 2004, is the same as this string ">May 11 2004, on the next
line of the include file.

Your help is greatly appreciated.

Thanks,

Joe
Jul 23 '05 #1
1 1094
On 15 Apr 2004 16:02:38 -0700, Joeyej <jo*************@quinnipiac.edu>
wrote:

[snip]
...but I'd prefer to alert the user (return false) if this string
">May 11 2004, is the same as this string ">May 11 2004, on the next
line of the include file.


/* This extracts the date section (all text before
* the first comma) so it can be compared.
*/
var fCD = FirstCh.substring( 0, First.indexOf( ',' ));
var sCD = SecondCh.substring( 0, Second.indexOf( ',' ));

if(( 'none' == FirstCh ) || ( 'none' == SecondCh ) || ( fCD == sCD ))
{
/*...*/
}

Hope that helps,
Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2

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

Similar topics

1
by: Henry | last post by:
I have a table that stores a list of zip codes using a varchar column type, and I need to perform some string prefix pattern matching search. Let's say that I have the columns: 94000-1235 94001...
3
by: googleboy | last post by:
Hi there. I have defined a class called Item with several (about 30 I think) different attributes (is that the right word in this context?). An abbreviated example of the code for this is: ...
8
by: Gordon Knote | last post by:
Hi can anyone tell me what's the best way to search in binary content? Best if someone could post or link me to some source code (in C/C++). The search should be as fast as possible and it would...
10
by: Phil Latio | last post by:
How do I use wildcards when searching in array? At least that's what I think I need !! I have the line: if ($attribute != "id") The above is not 100% correct because it should also be...
4
by: Hunk | last post by:
Hi I have a binary file which contains records sorted by Identifiers which are strings. The Identifiers are stored in ascending order. I would have to write a routine to give the record given...
9
by: | last post by:
I am interested in scanning web pages for content of interest, and then auto-classifying that content. I have tables of metadata that I can use for the classification, e.g. : "John P. Jones" "Jane...
4
by: Costa | last post by:
I am looking for a c/c++ text search engine library that supports: - free text searching - not only beginning of words but substrings as well - wildcard searching - I want strings such as...
2
by: Joe Strout | last post by:
Catching up on what's new in Python since I last used it a decade ago, I've just been reading up on template strings. These are pretty cool! However, just as a template string has some advantages...
1
by: Ben | last post by:
I apologize in advance for the newbie question. I'm trying to figure out a way to find all of the occurrences of a regular expression in a string including the overlapping ones. For example,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.