CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.classifieds_starter_kit Tags:
Item Type: NewsGroup Date Entered: 4/24/2007 12:03:53 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 11 Views: 55 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
12 Items, 1 Pages 1 |< << Go >> >|
darkknight187
Asp.Net User
CreateUserWizard Check Box validation Problem4/24/2007 12:03:53 AM

0/0

So I made a working bit of code (javascript) to validate a Terms Of Use checkbox.

When the checkbox and CustomValidator are inside The "CreateUserWizard" form It won't work.

Outside it, there's no problems. My code is:

 

<asp:CheckBox ID="AcceptTermsCheckBox" runat="server" Text="&nbsp;I agree to the Detelli Property Network"

Font-Size="8" ForeColor="#133792" ValidationGroup="CreateUserWizardControl" /><br />

&nbsp;<asp:HyperLink runat="server" NavigateUrl="Terms.aspx"

ForeColor="#133792" Font-Underline="true" ID="Terms" Font-Size="8">terms of use.</asp:HyperLink><br />

<asp:CustomValidator ID="ValTermsCheckBox" ClientValidationFunction="AcceptTermsCheckBoxValidation"

runat="server" ErrorMessage="Please accept Terms and Conditions." ValidationGroup="CreateUserWizardControl" OnServerValidate="ValTermsCheckBox_ServerValidate">

</asp:CustomValidator>

And my javascript code, that I can only place outside the "CreateUserWizard" form, is:

 

<script language="javascript" type="text/javascript">

function AcceptTermsCheckBoxValidation(source, args)

{

args.IsValid = document.getElementById(

'<%= AcceptTermsCheckBox.ClientID %>').checked;

}

</script>

I've been trying to write some Visual Basic in the code behind that I can use,

but it's not working, no matter what I do it pulls up the error as though the checkbox is unchecked. 

 

Protected Sub ValTermsCheckBox_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)

Dim AcceptTermsCheckBox As CheckBox = CreateUserWizardStep1.Controls(0).FindControl("AcceptTermsCheckBox")

If AcceptTermsCheckBox.Checked = True Then

args.IsValid =

True

End If

End Sub

 

This is really leaving me stumped, any ideas would be greatly appreciated. 

Thank you in advance

 


Be sure to visit www.detelli.com

And please remember to click ?Mark as Answer? on the post that helps you.
This can be beneficial to other community members reading the thread.
darkknight187
Asp.Net User
Re: CreateUserWizard Check Box validation Problem4/25/2007 2:50:38 PM

0/0

I have now figured it out, and for anyone having the same concern, here's what I did.

In the end I did not use any code behind so ignore that. looking at the origianal code (javascript, checkbox, and custom validator) I discovered that the javascript could not find checkbox once it was imbeded into the "CreateUserWizard". So all I had to do was give it a proper location.

 

<script type="text/javascript">

function AcceptTermsCheckBoxValidation(source, args)

{

args.IsValid = document.getElementById('<%= CType(CreateUserWizardStep1.ContentTemplateContainer.FindControl("AcceptTermsCheckBox"), CheckBox).ClientID %>')

if (!args.IsValid.checked)

{

ValTerms.Validate;

return false;

}

else {

return true;

}

}

</

script>

 

<

asp:CheckBox ID="AcceptTermsCheckBox" runat="server" Text="&nbsp;I agree to the Detelli Property Network"

Font-Size="8" ForeColor="#133792" ValidationGroup="CreateUserWizardControl" /><br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:HyperLink runat="server" NavigateUrl="Terms.aspx"

ForeColor="#133792" Font-Underline="true" ID="Terms" Font-Size="8">terms of use.</asp:HyperLink><br />

 

<asp:CustomValidator ID="ValTerms" ClientValidationFunction="AcceptTermsCheckBoxValidation"

runat="server" ErrorMessage="Please Accept Terms Of Use." ValidationGroup="CreateUserWizardControl">

</asp:CustomValidator>

 

I haven't tested this on anything other than IE but I'm sure it's fine.

It took forever but it feels so good to beat that code.

Good Luck to all.

 

 


Be sure to visit www.detelli.com

And please remember to click ?Mark as Answer? on the post that helps you.
This can be beneficial to other community members reading the thread.
Goldfish
Asp.Net User
Re: CreateUserWizard Check Box validation Problem5/17/2007 9:39:30 PM

0/0

I tried to put the Javascript codes in the .js file and included the .js file in the .aspx.  I find that the object will be null (due to document.getElementById can not get the object).  Any idea?

Thanks.

darkknight187
Asp.Net User
Re: CreateUserWizard Check Box validation Problem5/19/2007 1:44:08 AM

0/0

I had errors when I put it in a .js file, mainly because I'm using MasterPages, try just putting the code in your page outside of the CreateUserWizard section. If you're still having errors, post your code and errors.


Be sure to visit www.detelli.com

And please remember to click ?Mark as Answer? on the post that helps you.
This can be beneficial to other community members reading the thread.
Mattw67
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/18/2008 4:56:30 AM

0/0

Kool thanks!

This is exactly what i needed.

But it doesn't work with Firefox  :-(

And i need it with Firefox.

Someone have an idea why it is not working with Firefox?

N.B. Dont works for me with IE 6 in a .js external file.

A1ien51
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/18/2008 6:04:30 PM

0/0

If youwant to debug in JavaScript it has a JavaScript cConsole. itwill tell you what the JavaScript Error is when you look at it. Also you can install the firebug extension to get even better control over the errors. [getFirebug.com]

 Eric
 


Coauthor of Ajax In Action [#1 Computer and Internet book on Amazon for 2006]
Ajax Developer for http://www.RadiusIM.com [Radius Screen Name: A1ien51]

If you get an answer to your question, please mark it solved so people don't waste time reading already answered questions!
A1ien51
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/18/2008 6:06:54 PM

0/0

What is ValTerms.Validate;

Does not look like valid JavaScript to me.

Eric 


Coauthor of Ajax In Action [#1 Computer and Internet book on Amazon for 2006]
Ajax Developer for http://www.RadiusIM.com [Radius Screen Name: A1ien51]

If you get an answer to your question, please mark it solved so people don't waste time reading already answered questions!
Mattw67
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/18/2008 6:17:36 PM

0/0

It's the ID of the

<asp:CustomValidator ID="ValTerms" ClientValidationFunction="AcceptTermsCheckBoxValidation"

 

runat="server" ErrorMessage="Please Accept Terms Of Use." ValidationGroup="CreateUserWizardControl">

 

</asp:CustomValidator>

darkknight187
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/19/2008 1:09:55 AM

0/0

Check it on my site on the register page in firefox.

I am still using the same code, and it works great.

www.detelli.com/register.aspx

 


Be sure to visit www.detelli.com to find and list your Houses for rent

And please remember to click ?Mark as Answer? on the post that helps you.
This can be beneficial to other community members reading the thread.
Mattw67
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/19/2008 1:51:27 AM

0/0

Hummm, can you show me your actual code please...

Is your Terms of use checkbox still inside the CreateUserWizard and your submit button?

Thanks

darkknight187
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/19/2008 2:59:00 AM

0/0

You know, now that I am home from work and can look at it, I think I did have the same problem at first.

Try this.

<script type="text/javascript"> function AcceptTermsCheckBoxValidation(source, args)

{

 

var vCheckBox = document.getElementById('<%= CType(CreateUserWizardStep1.ContentTemplateContainer.FindControl("AcceptTermsCheckBox"), CheckBox).ClientID %>');if (!vCheckBox.checked)

{

args.IsValid =
false;}else {args.IsValid = true;

}

}

</script>

 

And this is inside the user wizard control.

<div id="agree_terms">

<asp:CheckBox ID="AcceptTermsCheckBox" runat="server" Text="&nbsp;I agree to the Detelli Property Network"

Font-Size="8" ForeColor="#133792" ValidationGroup="CreateUserWizardControl" /><br />

 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:HyperLink runat="server" NavigateUrl="Main/Terms.aspx"

ForeColor="#133792" Font-Underline="true" ID="Terms" Font-Size="8" Target="_blank">terms of use.</asp:HyperLink><br />

 

<asp:CustomValidator ID="ValTerms" ClientValidationFunction="AcceptTermsCheckBoxValidation"

runat="server" ErrorMessage="Please Accept Terms Of Use." ValidationGroup="CreateUserWizardControl">

</asp:CustomValidator>

</div>

Sorry about that, it was quite a while ago that I wrote that code.

 


Be sure to visit www.detelli.com to find and list your Houses for rent

And please remember to click ?Mark as Answer? on the post that helps you.
This can be beneficial to other community members reading the thread.
Mattw67
Asp.Net User
Re: CreateUserWizard Check Box validation Problem1/19/2008 3:08:35 AM

0/0

yeah!!! Now you're right  ;-)

I just examine your page code at http://www.detelli.com/register.aspx and saw the differences in the code.

Thanks darkknight187!

Very appreciated!

12 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Microsoft Visual C# 2005 Unleashed Authors: Kevin Hoffman, Pages: 692, Published: 2006
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Beginning Expression Web Authors: Zak Ruvalcaba, Pages: 474, Published: 2007
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006
Professional Visual Studio 2005 Authors: Andrew Parsons, Nick Randolph, Pages: 869, Published: 2006
Beginning ASP.NET 2.0 Databases: From Novice to Professional Authors: Damien Foggon, Pages: 625, Published: 2006
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005

Web:
CreateUserWizard Check Box validation Problem - ASP.NET Forums Re: CreateUserWizard Check Box validation Problem. 04-25-2007, 10:50 AM. Contact ... Re: CreateUserWizard Check Box validation Problem ...
asp:CreateUserWizard - standard control with added checkbox not ... asp:CreateUserWizard - standard control with added checkbox not validating now?? plz plz help. Last post 04-14-2008 3:31 AM by XiaoYong Dai ...
Validating a checkbox within CreateUserWizard within a MasterPage ... Validating a checkbox within CreateUserWizard within a MasterPage ... The problem is that this is all within a MasterPage, and everytime I try to reference ...
DotNetSlackers: The CreateUserWizard and Validation ErrorMessages Jul 24, 2008 ... Out of the box, the CreateUserWizard control offers a fully functional ... check out Customizing the CreateUserWizard Controland Storing ...
TheMSsForum.com >> Asp >> How to change CreateUserWizard error ... I would like to partial update until the validation is sucessful and then do a ... So my problem is this: The check box column displays ok but it will not ...
Scott on Writing Jul 24, 2008 ... re: The CreateUserWizard and Validation ErrorMessages 7/25/2008 9:00 PM Scott Mitchell. Andrei, check out this blog post. ...
CreateUserWizard Class CreateUserWizard control properties represented by text boxes, ... The CreateUserWizard control uses a validation group so that other fields on the same ...
ASP.NET Wiki: Security: Authentication and Authorization ... The CreateUserWizard control provides the user interface for the MembershipProvider object that ... VALIDATION PROBLEM: Checkbox required field question ...
How to: Customize the ASP.NET CreateUserWizard Control UpdateUser(user) ' Show or hide the labels based on the checkbox values. .... As long as this validation is enabled, you do not need to explicitly check for ...
How to: Customize the ASP.NET CreateUserWizard Control You can customize the contents of the CreateUserWizard control using the ... UpdateUser(user) ' Show or hide the labels based on the checkbox values. ...




Search This Site:










impersonation or credentials ?

advanced templating - don't try this at home!

documents module in ibuyspy

google adsense by wattwanderinfo

error: edit text/html is currently unavailable.

file upload using web service through thread

authenticating a client ( a library) which refernces a web service

alias,title ???

disable scrolling

non ie browser rendering of web controls (or not)

customizing a dropdownlist

modifications

module title & hr line

nested masterpage problem

trying to generate a random password

menubreakcssclass

display external page in content1 ?

remembering a password

my tableadapter doesn't show up on the toolbox

dnn and vs2005

what's new in v2?

4.0.0_install error

menu customization in dnn3

search paging

securing data reading

how to pass a parameter to a stored procedure

how to apply selectednodestyle in treeview

tabstrip - inconsistent errors

very peculiar problem -- either "could not load type ..." or "unable to start debugging..." depending on asp.net version.

relatively positioned div in a custom module...

 
All Times Are GMT