Hello,
I have a form includes one text box named "Date", one Submit botton named " Add Item" which will submit the form and open other form.
there is onemore button named " Add Mileage" which by pushing that, I would like to check if the text box named " Date" is empty or not and in both case will open other window and depends if the text box is empty or not, shows different messages in new window open up.
Please please please let me know if you have any solution.
Best Regards,
Faranak
6 1455
Hello,
I have a form includes one text box named "Date", one Submit botton named " Add Item" which will submit the form and open other form.
there is onemore button named " Add Mileage" which by pushing that, I would like to check if the text box named " Date" is empty or not and in both case will open other window and depends if the text box is empty or not, shows different messages in new window open up.
Please please please let me know if you have any solution.
Best Regards,
Faranak
If you are going to submit the form either way and open a new window either way, you probably one need 1 button right? If you are talking about alert boxes like a validation of a form before submission, then yes you will need to use javascript or client side vbscript.
A perfect example of this can be found here http://www.w3schools.com/js/js_form_validation.asp
If you are going to submit the form though you can just use ASP to check the value -
dim UserDate
-
UserDate = request.form("txtDate")
-
if UserDate = "" then
-
'determine message string
-
else
-
'they entered the date
-
end if
-
Thanks for your reponse, but It is not clear to me yet. Here is my code:
<form name="Formd" action="ContractorExpenseAddItem.asp" method="post" >
<input name="WeekEndingDate" ID="WeekEndingDate" type="text">
<td colspan="1" valign="top"><span class="text"><input type="submit" value="Add Item >"> </span></td>
<td colspan="1" valign="top" width="200"><input type="button" onClick=window.open('ContractorExpenseAddMileage.a sp?IID=<%=A%>','AddMileageWindow','width=600,heigh t=250,toolbar=yes,location=yes,directories=yes,sta tus=yes,scrollbars=yes,copyhistory=yes,resizable=y es') value="Add Mileage >"></td>
</form>
As you see, by Submitting "Add Item" in form action I am submitting the form and opening other form.
My problem is with other button named " Add Mileage" when I click on the button I want to validate the text box first then open other window so basically my form is not submitting so I can't request.form the text box value!!!!!
What should I do? :(
Thanks for your reponse, but It is not clear to me yet. Here is my code:
<form name="Formd" action="ContractorExpenseAddItem.asp" method="post" >
<input name="WeekEndingDate" ID="WeekEndingDate" type="text">
<td colspan="1" valign="top"><span class="text"><input type="submit" value="Add Item >"> </span></td>
<td colspan="1" valign="top" width="200"><input type="button" onClick=window.open('ContractorExpenseAddMileage.a sp?IID=<%=A%>','AddMileageWindow','width=600,heigh t=250,toolbar=yes,location=yes,directories=yes,sta tus=yes,scrollbars=yes,copyhistory=yes,resizable=y es') value="Add Mileage >"></td>
</form>
As you see, by Submitting "Add Item" in form action I am submitting the form and opening other form.
My problem is with other button named " Add Mileage" when I click on the button I want to validate the text box first then open other window so basically my form is not submitting so I can't request.form the text box value!!!!!
What should I do? :(
Well it all depends on what you require of the behavior of the app.
You can't have it both ways. You either need to validate the form prior to submission, (i.e don't let them submit unless the form is correct) or you need to go ahead and let them submit the form, and do your checking on the other side with the request.form like above.
Either way you really only need 1 button. Then you just need to call your validating javascript from the onsubmit event of the form, like was displayed in the above example link. -
<script type="text/javascript">
-
function validate_required(field,alerttxt)
-
{
-
with (field)
-
{
-
if (value==null||value=="")
-
{alert(alerttxt);return false;}
-
else {return true}
-
}
-
}function validate_form(thisform)
-
{
-
with (thisform)
-
{
-
if (validate_required(email,"Email must be filled out!")==false)
-
{email.focus();return false;}
-
}
-
}
-
</script>
-
-
<form action="nextwindow.asp"
-
onsubmit="return validate_form(this)"
-
method="post">
-
I guess if this still doesn't answer your question please provide more info on exactly what you are trying to accomplish. Are you trying to do a calculation for the user before he proceeds to the final window? Or are you trying to actually do a validation before the user submits?
Again I must say that if you are wanting them to submit the form either way then just use your request.form method on the next page to check the value and display your messages then.
I do think I see what you are trying to do. You are trying to bring up a popup window with information on it if they submit the form a certain way (with the value entered)? If so you can just do a pop up window on the body onload event on the ContractorExpenseAddItem.asp page, that will get its info from the request.form data.
All kind of guesses though since I'm not sure what your final goal is here.
Thanks a bunch.
how should I complete the following code:
onClick="javascript:window.open('abc.asp'
if I want to send a parameter with it without submitting the form?
It should be something like the following line, but it is not right!!!
onClick="javascript:window.open( 'ContractorExpenseAddMileage.asp?A=) + escape(document.theForm.userName.value)"
Thanks
oh Jeff,
Thank you sooooooooooooooooooooo much. I could write the correct line and it is working :)
<input type="button" value="Add Mileage >" onClick="javascript:window.open( 'ContractorExpenseAddMileage.asp?WED=' + escape(document.Formd.WeekEndingDate.value))" />
Thanks
Faranak
oh Jeff,
Thank you sooooooooooooooooooooo much. I could write the correct line and it is working :)
<input type="button" value="Add Mileage >" onClick="javascript:window.open( 'ContractorExpenseAddMileage.asp?WED=' + escape(document.Formd.WeekEndingDate.value))" />
Thanks
Faranak
Excellent!
Glad I could help
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Venkat |
last post by:
Hi All,
I know that this is not right forum to address this issue, i had posted
this problem in Javascript forum but of no use, i appreciate if any
one of you can answer or point me to some...
|
by: Venkat |
last post by:
Hi All,
I am not able to access a dll function from a remote script using
ActiveXobject when
an output parameter is used, but i could able to access the same when no
output parameter
is used....
|
by: annon |
last post by:
I've noticed that some problems come up frequently that are of importance in
writing web pages, because they're pretty fundamental points.
For general reference, here are some collected...
|
by: Matt Kruse |
last post by:
http://www.JavascriptToolbox.com/bestpractices/
I started writing this up as a guide for some people who were looking for
general tips on how to do things the 'right way' with Javascript. Their...
|
by: Oleg Konovalov |
last post by:
Hi,
I am trying to pass a bunch of checked checkboxes (Javascript array)
from page1 to the Java action class on subsequent web page (page2).
(on page 1 I have a bunch of DB rows with a checkbox,...
|
by: ged |
last post by:
Hi,
i am a oo (c#) programmer, and have not used javascript for a while and
i cant work out how javascript manages its references. Object
References work for simple stuff, but once i have an...
|
by: Nathan Sokalski |
last post by:
I am a beginner with AJAX, and have managed to learn how to use it when
passing single parameters, but I want to return more than one value to the
client-side JavaScript function that displays it....
|
by: sorobor |
last post by:
dear sir ..
i am using cakephp freamwork ..By the way i m begener in php and javascript ..
My probs r bellow
I made a javascript calender ..there is a close button ..when i press close button...
|
by: ismailc |
last post by:
Hi, I need help please
I usually code in coldfusion but now i want to create 2 text html files where i
pass a parameter on href?
This normally works in coldfusion!
Page1
<a...
|
by: willyWEB66 |
last post by:
Hi everyone, I'm having problem with the sequence of execution for xml.onload. It works fine if your not passing parameters to onload event but my code needs to pass parameter to its function. I'm...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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: 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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |