Busek
04-20-2005, 05:26 PM
Hi, i'm wondering how to do this:
1. Heres a form and when i press the submit button (search) it will change to another value. I've already tried onclick="document.search.submit.value='Now Searching...'"> but because of the frames i'm using the text will always remain as the new value (Seach -> Now Searching...). Is it possible that the value is reset after, lets say 2 seconds?
2. While in the new value (Now Searching...) is shown and I press it again an alert pops up that says: Now searching, please be patient. Of course after those two seconds when the value is only "search" again that alert shouldn't pop up.
3. If the option-value is selected as "code" only numbers can be entered (if letters then alert)
Heres the code I use that i want to modify..
<script language="JavaScript" type="text/javascript">
function form_validator(theForm) {
if(theForm.searchstring.value == "") {
alert("The form i empty!");
theForm.searchstring.focus();
return(false);
}
return (true);
}
</script>
<form name="search" onsubmit="return form_validator(this)" method="post" target="main" action="search_list.asp">
<select name="chose" class="select">
<option selected value="item">Search</option>
<option value="item">-------------------</option>
<option value="code">Code</option>
<option value="item">Item</option>
<option value="text">Text</option>
</select>
<input type="text" name="searchstring" value="" size="15" class="search">
<input name="submit" type="submit" value=" Search ">
</form>
I understand if this will be difficult. But thanks anyway for trying, appreciate it.
/ Matt
1. Heres a form and when i press the submit button (search) it will change to another value. I've already tried onclick="document.search.submit.value='Now Searching...'"> but because of the frames i'm using the text will always remain as the new value (Seach -> Now Searching...). Is it possible that the value is reset after, lets say 2 seconds?
2. While in the new value (Now Searching...) is shown and I press it again an alert pops up that says: Now searching, please be patient. Of course after those two seconds when the value is only "search" again that alert shouldn't pop up.
3. If the option-value is selected as "code" only numbers can be entered (if letters then alert)
Heres the code I use that i want to modify..
<script language="JavaScript" type="text/javascript">
function form_validator(theForm) {
if(theForm.searchstring.value == "") {
alert("The form i empty!");
theForm.searchstring.focus();
return(false);
}
return (true);
}
</script>
<form name="search" onsubmit="return form_validator(this)" method="post" target="main" action="search_list.asp">
<select name="chose" class="select">
<option selected value="item">Search</option>
<option value="item">-------------------</option>
<option value="code">Code</option>
<option value="item">Item</option>
<option value="text">Text</option>
</select>
<input type="text" name="searchstring" value="" size="15" class="search">
<input name="submit" type="submit" value=" Search ">
</form>
I understand if this will be difficult. But thanks anyway for trying, appreciate it.
/ Matt