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().
"r0adhog" <roadhog@nospam .phreaker.net> wrote in message
news:eEoz2kdPEH A.2468@TK2MSFTN GP11.phx.gbl...[color=blue]
> 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.
>
>
>[/color]
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" <roadhog@nospam .phreaker.net> wrote in message
news:eEoz2kdPEH A.2468@TK2MSFTN GP11.phx.gbl...[color=blue]
> 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.
>
>
>[/color]
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(docum ent.MyForm.all( "FieldName").va lue)
document.MyForm .summit()
End If
Will that work?
rh
"r0adhog" <roadhog@nospam .phreaker.net> wrote in message
news:eEoz2kdPEH A.2468@TK2MSFTN GP11.phx.gbl...[color=blue]
> 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.
>
>
>[/color]
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.val ue
if(x) {f.FieldName.va lue=CleanedUp(v ); }
return true;
}
function CleanedUp(s) {
return 'what should this be?';
}
</script>
<form onsubmit="retur n 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" <roadhog@nospam .phreaker.net> wrote in message
news:OH%23RptdP EHA.1644@TK2MSF TNGP09.phx.gbl. ..[color=blue]
> 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(docum ent.MyForm.all( "FieldName").va lue)
> document.MyForm .summit()
> End If
>
> Will that work?
>[/color]
r0adhog wrote:[color=blue]
>
> 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(docum ent.MyForm.all( "FieldName").va lue)
> document.MyForm .summit()
> End If
>
> Will that work?[/color]
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:
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.
"Dave Anderson" <GTSPXOESSGOQ@s pammotel.com> wrote in message
news:O5%23zW%23 dPEHA.3012@TK2M SFTNGP09.phx.gb l...[color=blue]
>
> I object to VBScript on the client for religious reasons, FWIW.[/color]
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.
Comment