CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Validation script help

Print topic Send  topic

Author Message
Henryk

Posts: 63
Posted: 05/26/2004, 6:48 AM

I cut and paste the script from the help docs (with modification for my needs) for onvalidate event. Before I tried it I wanted to run it by folks because I am fairly certain it will not work as is. Primarily the is null statement.

Function Registration_OnValidate()

If Registration.status.Value = Closed and Registration.closetime.Value 'is null' Then
Registration.Errors.addError("You must put in a close time when the ticket is closed.")
End if

End Function
View profile  Send private message
Henryk

Posts: 63
Posted: 05/26/2004, 7:48 AM

This is a cut and paste of what I have so far:

<%
'BindEvents Method @1-6FBE46DC
Sub BindEvents()
Set dispatchtickets.status.CCSEvents("OnValidate") = GetRef("dispatchtickets_status_OnValidate")
End Sub
'End BindEvents Method

Function dispatchtickets_status_OnValidate() 'dispatchtickets_status_OnValidate @11-B08A4F4D

'Custom Code @48-73254650
' -------------------------
if dispatchti_maint3.Status.value = "Closed" then
if (dispatchti_maint3.CloseTime.value.length < 1) then
dispatchti_maint3.Errors.addError("You must specify the Close Time.")
end if
end if
' -------------------------
'End Custom Code

End Function 'Close dispatchtickets_status_OnValidate @11-54C34B28


%>

I chose the status field and then chose onvalidate and then chose custom code. As far as I can terll it should work properly, but every time I hit add I get page can not be displayed and the url ends in ....url/dispatchti_maint3.asp?ccsForm=dispatchtickets That url does not look right and I am not quite sure what is forcing it to do that (regardless of what I use in the status field). Now dispatchtickets is the name of the table in the db and the template is named dispatchti_maint3 so I am wondering if there is some kind of confusion in my script with this. Any suggestions? Should I do on validate for on submit?

Henryk
View profile  Send private message
peterr


Posts: 5971
Posted: 05/26/2004, 10:12 AM

The URL looks OK. The application created with CodeCharge Studio uses the ccsForm paramater internally.
The problem is probably in dispatchti_maint3.CloseTime.value.length. You can use the VBScript length function like Len(dispatchti_maint3.CloseTime.value).
Also, are there any additional error message shown besides "page can not be displayed"?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Henryk

Posts: 63
Posted: 05/26/2004, 10:20 AM

HTTP 500 - Internal server error

Revised it to read

if dispatchti_maint3.Status.value = "Closed" then
if len(dispatchti_maint3.timeofclose.value) then
dispatchti_maint3.Errors.addError("You must specify the Close Time.")
end if
end if


Same error.

I am feeling kind of silly, because this seems so straight forward.
View profile  Send private message
peterr


Posts: 5971
Posted: 05/26/2004, 10:29 AM

Looks like the main problem is rather the settings in your Web browser (IE) because you cannot see the real error messages, therefore you cannot fix them.
Please do this first: http://www.webwizguide.info/asp/faq/friendly_HTTP_error_messages.asp
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Henryk

Posts: 63
Posted: 05/26/2004, 10:38 AM

Good call Peter... This is now what I get

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'dispatchti_maint3'

.../dispatchti_maint3_events.asp, line 12

Line 12 is the first if statement.

Gonna do a little more plugging away to see where I screwed up, but I am wondering if maybe I should use table name instead of form name.

View profile  Send private message
Henryk

Posts: 63
Posted: 05/26/2004, 10:46 AM

Got it, thanks for all your help peter, this is what worked

if dispatchtickets.status.value = "Closed" then
if len(dispatchtickets.timeofclose.value)<1 then
dispatchtickets.Errors.addError("You must specify the Close Time.")
end if
end if

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.