|
Hello,
I am working on a site with an input form that has required field
validators. If the user doesn't enter something in one of the
textboxes, the error message appears. When they enter something and:
1) goto another field on the form (the error message clears) then
click OK, the click event fires as expected
2) click OK without focusing on another field, only the error message
is cleared but the click event is never fired, hence forcing the user
to click OK one more time to submit
Any idea why this weird behaviour is happening? I tried it on a
simple page with just a couple of textboxes and it worked fine, so I
am not sure why this is acting differently?
Any comments would be much appreciated.
|
|
|
|
|
The part you labeled 1) is how a validator is supposed to work. I'm assumming your problem is the 2) portion that is forcing the user to click twice. Do you have any other javascript on the page that is reacting to the textbox's onblur event or when it loses focus?
|
|
|
|
|
I tried doing some searching through the source, but couldn't find any code I have written to do that. But then again, this is a site based on SharePoint, so there is some JavaScript I do not have access to. Although, I'd be surprised if it is a bug inherent in SharePoint.
|
|
|
|
|
Without knowing more about your website, it's hard to say where you can start looking for a solution. If I were you, I'd probably try adding and setting up a new button that does the same as the other button and seeing if it does the same thing if you click THAT button. That would tell you if it's code related to the validator or the button. Then try adding and setting up a new validator...maybe a setting got messed up in that.
Hope this helps.
|
|
|
|
|
I have a Classic ASP website and i want to use MS SQL Express edition as the datasource. I tried the .NET Connectionstring and they do not work for the Classic ASP (ADO) site. I have tried figuring this out for the last three days. PLEASE HELP! Thanks in advance.
|
|
|
|
|
|
Using "classic" ASP
In this app, I've setup a javascript function (SetScreenWidth) that allows the programmer to specify a screen resolution so that the site's layout can be tested at various horizontal widths (1024, 1280, etc) without having to change the display properties on the desktop. If no value is passed to this function, the screenwidth will be set to whatever the user's desktop horizontal size is.
After calling this function, I set the value in a hidden form field to whatever screenwidth was determined by that function. The theory is that this should allow me to use that screenwidth elsewhere in the asp page via a (seemingly) simple retrieval of data from the hidden field.
I have verified that the hidden field is indeed being set to the expected value (I used the firebug DOM inspector for this), but when I try to use vbscript to retrieve the value from the hidden field, it fails with a "Object Required" error on the line indicated in red below.
<%@ LANGUAGE="VBSCRIPT" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form id="spanForm" name="spanForm" action="#">
<input id="screenSpanWidth" name="screenSpanWidth" type="hidden" />
</form>
<script language='JavaScript' type='text/javascript'>
SetScreenWidth(1024);
document.forms['spanForm'].screenSpanWidth.value = var_nScreenWidth.toString();
</script>
<%
Dim nUserScreenWidth
<code>nUserScreenWidth = Document.forms.namedItem("spanForm").screenSpanWidth.value</code>
%>
</body>
</html>
I'm desperate for help on this. Thanks in advance.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi
Possibly down to the capital D in Document. I always use the getElementById method to get the objects in the DOM - you could look into that perhaps.
If you use IE for development you can download the official IE developer toolbar which has this and some other great functionality included... And yes, i know the FireFox version is better!
Download IE developer toolbar from MS[^]
|
|
|
|
|
Your VBScript, being enclosed in <% ... %> is thus running on the server BEFORRE the page is sent to the browser, and so has no access to the document at this stage. You would need to post the form back to the server in order to be able to get such values....
You can use VBScript client side too, but it's not advosable (cross browser compatibility issues...)
|
|
|
|
|
Well, using client side vbscript is the answer (it works). We're not concerned about cross-browser stuff here because it's a DOD intranet site, and the government has a hard-on for IE. Anyway, you get a 5 for giving a workable solution.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Well crap - I want to use the value on the server side, but it won't let me.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
well having set it client-side, you can't expect to use it on the server until or unless you post the page back... (or make some ajax style callback)
|
|
|
|
|
|
JimmyRopes wrote: Ajax is your friend.
No, it's not. It's more like a hooker in the red-light district beckoning from the shadows. The site in question is classic ASP. I'm not permitted to use ANY technology other than html, css, javascript, and vbscript. I recommended that we convert it to aspx/C#, but I was told we don't have the funding for that.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: JimmyRopes wrote:
Ajax is your friend.
No, it's not.
Pardon me, I mistook you for someone who knew what AJAX is.
John Simmons / outlaw programmer wrote: I'm not permitted to use ANY technology other than html, css, javascript , and vbscript.
I see you do not understand what AJAX is.
Here's a question for you, "what does the J in AJAX stand for"?
John Simmons / outlaw programmer wrote: I recommended that we convert it to aspx/C#, but I was told we don't have the funding for that.
And presumably that relates to why you can't use AJAX in some way.
|
|
|
|
|
And you must have missed the point I was trying to make - I do not have the funding to refactor in any way.
Are you sure you're old enough to be using the web without your parents looking over your shoulder?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: And you must have missed the point I was trying to make - I do not have the funding to refactor in any way.
Then what are you doing touching the code?
John Simmons / outlaw programmer wrote: Are you sure you're old enough to be using the web without your parents looking over your shoulder?
Older than you! But then again I don't go around claiming I know what I am doing because I have X number of years doing it! Only frauds resort to that tactic!
|
|
|
|
|
http://en.wikipedia.org/wiki/XMLHttpRequest[^]
[ My Blog]
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
AJAX is just javascript. If you don't call it AJAX, it's probably fine, if you do, perhaps it's not :P
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Guys,
Do you have an idea on how to populate a field value from sql table to TextArea Control using code behind VB coding?
Thanks in advance Guys
hifiger2004
|
|
|
|
|
If it's a server control you can set it in your page prerender event. If it's not, you can add tags to pass the value through, but then it will occur at the start of your page lifecycle.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christ,
how will I code it if it's a server control?
I hope you can show me a bit of how it will be done
Thanks
hifiger2004
|
|
|
|
|
yes, prerender event is the solution. I just added the runat="server" and went toe prerender event, and then added some value. It works!
Thanks Christ
hifiger2004
|
|
|
|
|
Hi,
I am using C# 2.0 and I came across a section of code that looks like this:
Regex.Matches(strPassword, @"\W").Count
I don't understand what it is trying to count. Please can some help me out??
Thanks
ma se
|
|
|
|
|
That is counting the number of non-alphanumeric characters in the string, for example %, &, $ etc
|
|
|
|