Showing posts with label validator. Show all posts
Showing posts with label validator. Show all posts

Wednesday, March 21, 2012

html button runs javascript: how to make it see server validators?

I have an html button that reads a text box and runs a javascript.
I made a Required Validator on that text box , any web button follows that
validator.
My html button does not follow the validator
I want to force my html button to follow the validator, how to do it?
Any help is very appreciated...The validator calling code is generated for the Server controls for which
the 'Control To Validate' property is set. You could simply change your HTML
button to a server side control byt right clicking it and chosing Run at
server. Alternatively you could examine the code and copy/cludge it to call
the validator scripts.
"Bishoy George" <bishoy@.bishoy.com> wrote in message
news:%23Fgvgz9wFHA.3740@.TK2MSFTNGP14.phx.gbl...
>I have an html button that reads a text box and runs a javascript.
> I made a Required Validator on that text box , any web button follows that
> validator.
> My html button does not follow the validator
> I want to force my html button to follow the validator, how to do it?
> Any help is very appreciated...
>

html button runs javascript: how to make it see server validators?

I have an html button that reads a text box and runs a javascript.
I made a Required Validator on that text box , any web button follows that
validator.
My html button does not follow the validator
I want to force my html button to follow the validator, how to do it?
Any help is very appreciated...The validator calling code is generated for the Server controls for which
the 'Control To Validate' property is set. You could simply change your HTML
button to a server side control byt right clicking it and chosing Run at
server. Alternatively you could examine the code and copy/cludge it to call
the validator scripts.

"Bishoy George" <bishoy@.bishoy.com> wrote in message
news:%23Fgvgz9wFHA.3740@.TK2MSFTNGP14.phx.gbl...
>I have an html button that reads a text box and runs a javascript.
> I made a Required Validator on that text box , any web button follows that
> validator.
> My html button does not follow the validator
> I want to force my html button to follow the validator, how to do it?
> Any help is very appreciated...

Html 4.01 strict instead of xhtml?

Can I stop asp.net from applying self closing tags? I am trying to generate
an html 4.01 strict page rather than an xhtml page and the w3 validator is
unhappy about asp.net automatically translating this:
<link rel="stylesheet" href="http://links.10026.com/?link=SkinStyle.aspx?SkinName=Test" type="text/css">
to this:
<link rel="stylesheet" href="http://links.10026.com/?link=SkinStyle.aspx?SkinName=Test" type="text/css"
/>Hi Andy,
Regarding on the ASP.NET/VS IDE html formatting question you mentioned
they're actually controlled by the HTML Designer's formatting and
validation setting. You can configure them through the following approaches:
For the automatically close tag behavior, you can set it through the below
steps:
**open "tools --> options" menu,
** in the opened dialog, choose the following path in left view:
Text Editor-->HTML-->Format-->
and you'll find the "Auto Insert close Tag" check option
for the design-time validation(against html), you can also find the
following setting:
Text Editor-->HTML-->Validation --> "Target:"
you can choose "HTML 4.01" as your ASPX page's target validation
schema(instead of xhtml 1.0)
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
========================================
==========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Steven Cheng[MSFT] wrote:
> Hi Andy,
> Regarding on the ASP.NET/VS IDE html formatting question you mentioned
> they're actually controlled by the HTML Designer's formatting and
> validation setting. You can configure them through the following
> approaches:
> For the automatically close tag behavior, you can set it through the
> below steps:
> **open "tools --> options" menu,
> ** in the opened dialog, choose the following path in left view:
> Text Editor-->HTML-->Format-->
> and you'll find the "Auto Insert close Tag" check option
Hi, thanks for your help! I just tried this but it didn't make a difference.
The tag doesn't have self closing tags in the designer, only in the
outputted html.
Hi Andy,
Thanks for your reply and the further clarify.
Actually, I originally assume that you just want to change the edit
experience in IDE at design-time. So you also want the runtime html output
be formated without close tag ( "/>"), right?
I've performed some further test, actually, ASP.NET 2.0 runtime can let you
specify the "xhtmlConformance" to a "Legacy" value so that the output will
conform to ASP.NET 1.1 format, e.g.
===========
.........
<xhtmlConformance mode="Legacy"/>
</system.web>
============
However, when running the aspx page, such as below:
============
<html >
<head runat="server">
<link rel="stylesheet" href="http://links.10026.com/?link=SkinStyle.aspx?SkinName=Test" type="text/css">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" >
</div>
</form>
</body>
</html>
==============
the <input type="button" > can be keep without close tag, the <link ...>
will be formated to <link ... />. It seems the runtime engine will
transalte the tags in <head> section and ensure closing tag and there
hasn't any declarative means to configure this.
So far I think one way to overcome this behavior would be manually
customize the ASP.NET page's response output through a Response Filter
stream. You can attach a Filter for each Page's Response and modify the
response content. Here is a web article demonstrate using response Filter
to customize(format) page output:
http://aspnetresources.com/articles/HttpFilters.aspx
Producing XHTML-Compliant Pages With Response Filters
For your scenario, you may use it to change all the "/>" close tag to ">".
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Steven Cheng[MSFT] wrote:
> So far I think one way to overcome this behavior would be manually
> customize the ASP.NET page's response output through a Response Filter
> stream. You can attach a Filter for each Page's Response and modify
> the response content. Here is a web article demonstrate using
> response Filter to customize(format) page output:
> http://aspnetresources.com/articles/HttpFilters.aspx
> Producing XHTML-Compliant Pages With Response Filters
> For your scenario, you may use it to change all the "/>" close tag to
> ">".
Perfect, thank you!
You're welcome :)
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead

Html 4.01 strict instead of xhtml?

Can I stop asp.net from applying self closing tags? I am trying to generate
an html 4.01 strict page rather than an xhtml page and the w3 validator is
unhappy about asp.net automatically translating this:

<link rel="stylesheet" href="http://links.10026.com/?link=SkinStyle.aspx?SkinName=Test" type="text/css">

to this:

<link rel="stylesheet" href="http://links.10026.com/?link=SkinStyle.aspx?SkinName=Test" type="text/css"
/>Hi Andy,

Regarding on the ASP.NET/VS IDE html formatting question you mentioned
they're actually controlled by the HTML Designer's formatting and
validation setting. You can configure them through the following approaches:

For the automatically close tag behavior, you can set it through the below
steps:

**open "tools --options" menu,

** in the opened dialog, choose the following path in left view:

Text Editor-->HTML-->Format-->

and you'll find the "Auto Insert close Tag" check option

for the design-time validation(against html), you can also find the
following setting:

Text Editor-->HTML-->Validation --"Target:"

you can choose "HTML 4.01" as your ASPX page's target validation
schema(instead of xhtml 1.0)

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...rt/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Steven Cheng[MSFT] wrote:

Quote:

Originally Posted by

Hi Andy,
>
Regarding on the ASP.NET/VS IDE html formatting question you mentioned
they're actually controlled by the HTML Designer's formatting and
validation setting. You can configure them through the following
approaches:
>
For the automatically close tag behavior, you can set it through the
below steps:
>
**open "tools --options" menu,
>
** in the opened dialog, choose the following path in left view:
>
Text Editor-->HTML-->Format-->
>
and you'll find the "Auto Insert close Tag" check option


Hi, thanks for your help! I just tried this but it didn't make a difference.
The tag doesn't have self closing tags in the designer, only in the
outputted html.
Steven Cheng[MSFT] wrote:

Quote:

Originally Posted by

So far I think one way to overcome this behavior would be manually
customize the ASP.NET page's response output through a Response Filter
stream. You can attach a Filter for each Page's Response and modify
the response content. Here is a web article demonstrate using
response Filter to customize(format) page output:
>
http://aspnetresources.com/articles/HttpFilters.aspx
Producing XHTML-Compliant Pages With Response Filters
>
For your scenario, you may use it to change all the "/>" close tag to
">".


Perfect, thank you!
You're welcome :)

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

HTML 4.01 and the PostBack javascript

When I try to validate my webpages on http://validator.w3.org the validation
fails because of the auto-generated postback function:

<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform = document.defaultframework_Default;
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script
The reason for failing is that the script tag is missing the TYPE attribute.
Th script tag should be like this to be valid HTML 4.01:
<script language="javascript" type="text/Jscript"
Is there any way, any options or method for altering this SCRIPT tag?

I probably should say that I'm using .NET Framework 1.0.

Regards
Svein terje GaupWell I can't say for sure, but I doubt there is an "easy" way to change
this. What you can do is override the render event for the page, and do a
find/replace to alter the javascript before it is sent to the client.

It would be something like this in your codebehind, which inherits from
System.Web.UI.Page.

Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Dim sw As New System.IO.StringWriter
Dim localWriter As New HtmlTextWriter(sw)

MyBase.Render(localWriter)
Dim output As String = sw.ToString()

'here is where you would have to do a find/replace on the string to
edit the javascript tag
'but as an example I'll change everything to uppercase.
output = output.ToUpper()

writer.Write(output)

End Sub

--Michael

"Svein Terje Gaup" <gaupen@.yahoo.com> wrote in message
news:%23HRPohZ4DHA.3416@.tk2msftngp13.phx.gbl...
> When I try to validate my webpages on http://validator.w3.org the
validation
> fails because of the auto-generated postback function:
> <script language="javascript">
> <!--
> function __doPostBack(eventTarget, eventArgument) {
> var theform = document.defaultframework_Default;
> theform.__EVENTTARGET.value = eventTarget;
> theform.__EVENTARGUMENT.value = eventArgument;
> theform.submit();
> }
> // -->
> </script>
> The reason for failing is that the script tag is missing the TYPE
attribute.
> Th script tag should be like this to be valid HTML 4.01:
> <script language="javascript" type="text/Jscript">
> Is there any way, any options or method for altering this SCRIPT tag?
> I probably should say that I'm using .NET Framework 1.0.
> Regards
> Svein terje Gaup