Click to See Complete Forum and Search --> : Input Validation
I'm using data from a form on an .asp page to update a SQL table. Can I check
for required fields between the Submit button being clicked and the data
actually being submitted? I want to return the user to the input page if
there is additional information I need. Is this possible?
Michael Shutt
02-09-2001, 11:06 AM
One way to do this (at least with IE) would be to use some javascript on the
client side to perform some validation before the form is submitted. It
would look something like this:
<script language="javascript"><!--
function FormDataIsOK()
{
// do your validation here
if (document.forms('frmData').elements{'txtFirstName').value == '')
{
window.alert('You must provide a value for First Name');
return false;
}
// if we found no problems, return success
return true;
}
--></script>
<form id="frmData" action="Receive.asp" method="post" onSubmit="javascript:
return FormDataIsOK();">
<input type="text" id="txtFirstName" name="FirstName" />
<input type="submit" value="Submit" />
</form>
"Rae" <glenda_72364@yahoo.com> wrote in message
news:3a835fe3$1@news.devx.com...
>
> I'm using data from a form on an .asp page to update a SQL table. Can I
check
> for required fields between the Submit button being clicked and the data
> actually being submitted? I want to return the user to the input page if
> there is additional information I need. Is this possible?
Adeel Ahmed
02-09-2001, 03:42 PM
"Michael Shutt" <mshutt@mediaone.net> wrote:
>One way to do this (at least with IE) would be to use some javascript on
the
>client side to perform some validation before the form is submitted. It
>would look something like this:
>
><script language="javascript"><!--
>function FormDataIsOK()
>{
> // do your validation here
> if (document.forms('frmData').elements{'txtFirstName').value == '')
> {
> window.alert('You must provide a value for First Name');
> return false;
> }
>
> // if we found no problems, return success
> return true;
>
>}
>--></script>
>
><form id="frmData" action="Receive.asp" method="post" onSubmit="javascript:
>return FormDataIsOK();">
> <input type="text" id="txtFirstName" name="FirstName" />
> <input type="submit" value="Submit" />
></form>
>
>
>
>"Rae" <glenda_72364@yahoo.com> wrote in message
>news:3a835fe3$1@news.devx.com...
>>
>> I'm using data from a form on an .asp page to update a SQL table. Can
I
>check
>> for required fields between the Submit button being clicked and the data
>> actually being submitted? I want to return the user to the input page
if
>> there is additional information I need. Is this possible?
>
>
sachin awasthi
03-07-2001, 06:24 AM
One way that i think can be useful and is of general kind -
Which ever fields that are marked as required, name them differently.
i.e. if Name is a required field then give it a name as NAME_REQD
and when you do a submit, loop over all the fields and which every field
for name has last 5 charcters as "_REQD", if found check for existence of
data.
"Adeel Ahmed" <adeelahmed@yours.com> wrote:
>
>"Michael Shutt" <mshutt@mediaone.net> wrote:
>>One way to do this (at least with IE) would be to use some javascript on
>the
>>client side to perform some validation before the form is submitted. It
>>would look something like this:
>>
>><script language="javascript"><!--
>>function FormDataIsOK()
>>{
>> // do your validation here
>> if (document.forms('frmData').elements{'txtFirstName').value == '')
>> {
>> window.alert('You must provide a value for First Name');
>> return false;
>> }
>>
>> // if we found no problems, return success
>> return true;
>>
>>}
>>--></script>
>>
>><form id="frmData" action="Receive.asp" method="post" onSubmit="javascript:
>>return FormDataIsOK();">
>> <input type="text" id="txtFirstName" name="FirstName" />
>> <input type="submit" value="Submit" />
>></form>
>>
>>
>>
>>"Rae" <glenda_72364@yahoo.com> wrote in message
>>news:3a835fe3$1@news.devx.com...
>>>
>>> I'm using data from a form on an .asp page to update a SQL table. Can
>I
>>check
>>> for required fields between the Submit button being clicked and the data
>>> actually being submitted? I want to return the user to the input page
>if
>>> there is additional information I need. Is this possible?
>>
>>
>
Jeroen van Eck
03-13-2001, 04:38 AM
I have a similiar problem.
I want to write one procedure (vbscript) for validation and one for saving
data to the DB. As i have a lot of textboxes (it's a grid of 3 by 7 --> 21)
i want to use only one procedure. But how to manage this??? The names of
the textboxes are dates and a indexed integer. How do i get the procedure
to check from which textbox the event came (onchange).
"sachin awasthi" <sachin_awasthi@hotmail.com> wrote:
>
>One way that i think can be useful and is of general kind -
>Which ever fields that are marked as required, name them differently.
>i.e. if Name is a required field then give it a name as NAME_REQD
>and when you do a submit, loop over all the fields and which every field
>for name has last 5 charcters as "_REQD", if found check for existence of
>data.
>
>"Adeel Ahmed" <adeelahmed@yours.com> wrote:
>>
>>"Michael Shutt" <mshutt@mediaone.net> wrote:
>>>One way to do this (at least with IE) would be to use some javascript
on
>>the
>>>client side to perform some validation before the form is submitted.
It
>>>would look something like this:
>>>
>>><script language="javascript"><!--
>>>function FormDataIsOK()
>>>{
>>> // do your validation here
>>> if (document.forms('frmData').elements{'txtFirstName').value == '')
>>> {
>>> window.alert('You must provide a value for First Name');
>>> return false;
>>> }
>>>
>>> // if we found no problems, return success
>>> return true;
>>>
>>>}
>>>--></script>
>>>
>>><form id="frmData" action="Receive.asp" method="post" onSubmit="javascript:
>>>return FormDataIsOK();">
>>> <input type="text" id="txtFirstName" name="FirstName" />
>>> <input type="submit" value="Submit" />
>>></form>
>>>
>>>
>>>
>>>"Rae" <glenda_72364@yahoo.com> wrote in message
>>>news:3a835fe3$1@news.devx.com...
>>>>
>>>> I'm using data from a form on an .asp page to update a SQL table. Can
>>I
>>>check
>>>> for required fields between the Submit button being clicked and the
data
>>>> actually being submitted? I want to return the user to the input page
>>if
>>>> there is additional information I need. Is this possible?
>>>
>>>
>>
>
devx.com
Copyright Internet.com Inc. All Rights Reserved