473,320 Members | 1,876 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.

Change Form Field Value Prior to submit

I am trying to do some form validation.
Is there a way with vb script to change the value of a field
on a form prior to submit.

Jul 19 '05 #1
6 5494
with VBScript? You sure you want to use VBScript on the client?
Otherwise why do you need to change it BEFORE you submit? Can't you adjust
it after, before processing? If not yes, you'll have to do some work though.
I suggest having your submit button simply call a clientside function that
does your adjustments, then calls form.submit().
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"r0adhog" <ro*****@nospam.phreaker.net> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
I am trying to do some form validation.
Is there a way with vb script to change the value of a field
on a form prior to submit.

Jul 19 '05 #2
You could do this with client-side script, if you like. But, if you're
going to change it and you know what you're going to change it to, why not
do it in the ASP code that processes the form submission? Can you be a
little more specific about what you're trying to do?

Ray at work

"r0adhog" <ro*****@nospam.phreaker.net> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
I am trying to do some form validation.
Is there a way with vb script to change the value of a field
on a form prior to submit.

Jul 19 '05 #3
Ray/Curt,

I guess I could do it after the submit, was looking to do something like
If x = "true" then
document.MyForm.all("FieldName").value =
CleanedUp(document.MyForm.all("FieldName").value)
document.MyForm.summit()
End If

Will that work?

rh

"r0adhog" <ro*****@nospam.phreaker.net> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
I am trying to do some form validation.
Is there a way with vb script to change the value of a field
on a form prior to submit.

Jul 19 '05 #4
Well, this would be the client-side approach, not the ASP approach. As Curt
suggested, you should not use VBScript for client side scripting. Try
something like:

<script type="text/javascript">
function myFunction(f) {
// What is x?
var x = true;
var v = f.FieldName.value
if(x) {f.FieldName.value=CleanedUp(v); }
return true;
}

function CleanedUp(s) {
return 'what should this be?';
}
</script>
<form onsubmit="return myFunction(this);">
Again, what are you trying to do? You're not doing this to deal with
apostrophes or anything, I hope, are you?

Ray at work
"r0adhog" <ro*****@nospam.phreaker.net> wrote in message
news:OH****************@TK2MSFTNGP09.phx.gbl...
Ray/Curt,

I guess I could do it after the submit, was looking to do something like
If x = "true" then
document.MyForm.all("FieldName").value =
CleanedUp(document.MyForm.all("FieldName").value)
document.MyForm.summit()
End If

Will that work?

Jul 19 '05 #5
r0adhog wrote:

I guess I could do it after the submit, was looking to do something
like If x = "true" then
document.MyForm.all("FieldName").value =
CleanedUp(document.MyForm.all("FieldName").value)
document.MyForm.summit()
End If

Will that work?


It pains me to say, "probably" (except for the misspelled submit() method),
but it certainly depends on intercepting the submission.

It pains me for three reasons: (1) VBScript on the client, (2) the use of
..all, and (3) referencing a collection with parentheses instead of brackets.
Internet Explorer lets you get away with all three, but I don't consider
that a good thing.

Generally speaking, form element references ought to look like this:

document.MyForm.elements["FieldName"]

If you don't use funky characters for naming your fields (and don't collide
with the FORM element's property/method namespace, you can get away with
this:

document.MyForm.FieldName

Examples that require the former:

<INPUT NAME="Address(2)"> **
<INPUT NAME="submit"> ***

I object to VBScript on the client for religious reasons, FWIW.

**I've actually seen this!!
***Probably one of the most common newbie errors
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #6

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:O5******************@TK2MSFTNGP09.phx.gbl...

I object to VBScript on the client for religious reasons, FWIW.


This topic doesn't seem to be addressed in my current reading, the Complete
Idiot's Guide to Understanding Judaism, so I guess it must be some other
religion.

Ray at work
Jul 19 '05 #7

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

Similar topics

2
by: www | last post by:
Hi there, I' m getting a (0x80040E2F) error, if I submit my form, with blank textboxes to my update stored procedure. The stored procedure expect values, so how can I detect if a form field was...
8
by: Matt Herson | last post by:
I have been trying to find a way to use JavaScript to change the value of a hidden field on submit. I am already invoking a JavaScript to handle the validation on submit. The reason I need to...
8
by: shandain | last post by:
Ok, I have done this a million times, and I can't get this to work... I hope I am just being an idiot and missing something... but I can't see it... so please call me an idiot and tell me what it...
5
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform'...
4
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to...
2
by: Vinny | last post by:
I'm writing a small ASP program which prompts the user for data. I would like to interactively validate the data as they are entering it, rather than waiting until they submit the form. So, I am...
2
by: Vinny | last post by:
A customer wants me to convert a VB app I wrote for them into a web app for remote users to do data entry. So, I'm writing a small ASP program which prompts the user for data, much like a VB...
7
by: -Nacho- | last post by:
Hi group I have a form with fields for NAME and SURNAME. I need them in different fields, but I also need to submit them as a unique field "COMPLETENAME". Is there any way to "capture" them when...
2
by: Cerebral Believer | last post by:
Hi folks, Can anyone help me with this form: http://futurebydesign-music.com/_member/club_fbd_reg.php I have followed to coding instructions aas closely as I can, but I am getting errors...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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: 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

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.