CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Losing Label with OnValidate Event

Print topic Send  topic

Author Message
Sjg
Posted: 11/16/2002, 12:57 AM

Using ASP 3.0 Templates.

On a Maintenance Record Form - Any LAbel Fields disappear when OnValidate is used to set Error.

Using the Application Wizard, I created a 2 field Maintence Form for a record. One Field was a Label and the other Field was a Text Box.

Two Field Form - 1 Label and 1 Text Box. Label Tied to Client_City database field. Textbox Tied to Client_Company databas field. Both fields have data stored in database.

The Only User Code was placed in the OnValidate Event.

In the On Validate Event:

Function Client_OnValidate() 'Client_OnValidate @2-850F8828

'Custom Code @8-73254650
' -------------------------
' Write your own code here.
' -------------------------

Client.Errors.AddError "Sjg"

'End Custom Code

End Function 'Close Client_OnValidate @2-54C34B28

------------

No Other Code was placed in Events.

When Submit Button is pressed, the Error "Sjg" comes up like it should but all Label Fields get blanked out.

If a field is marked as required and no error is added in the onvalidate event. The required message shows as it should and the label data is retained.

If a field is marked as required and an error is added in the onvalidate event. The required message shows as it should, the error message from the onvalidate message shows as it should but the label data is not retained.

If an error is generated in the onvalidate event, then any label database fields should retain their values.

What needs to be set so that errors in the onvalidate event will behave like an error generated when a field is marked as required?
feha
Posted: 11/16/2002, 3:54 AM

I'm affraid that You can't use label field for validation as label field doesn't pass values while submitting form.
Tips:
create under label a new field mark it as HIDDEN and let it contain the same value of label and validate that hidden field instead.
While label will only show the value but the hidden field will be used for validation.(Names of both fields can't be same).

Hope this helps

regards
feha
[www.vision.to]
Sjg
Posted: 11/19/2002, 9:04 PM

No kidding.

I am not using it for validation. The label field, like all label fields is display only. For example, the label field can be a timestamp that the record was inserted on.

In the On-Validate exit, posting an error with the AddError method causes the form to return the error message that is used in the AddError Method.

Any field that is a label is not shown on the page.

If you would have read what I wrote, you would have seen the the form was a two field form. A Label and a Text Box. You would have further seen that the only thing that the on validate exit is doing is adding adding/posting an error. No logic dependent on anything, simply using the adderror method.

This causes the label to be blanked out when you press submit and the error from the adderror method is returned.

Next time read what you are replying too.

This same form with no code in the On-Validate exit but with the text box marked as required will return the error message that the field is required and not blank out the label field.

My point is that CCS has a bug and that the AddError method in the On-Validate should not cause the label to be blanked out.

The CC people have confirmed this is a problem ad are looking into it.

feha
Posted: 11/20/2002, 1:38 AM

Sorry My intention was to help You.
There will be no "NEXT TIME" I will not spend my time ,have other things to do :-)




regards
feha
[www.vision.to]
Sjg
Posted: 11/20/2002, 1:15 PM

Sorry that came out bad. I was in a real hurry and had been in front of the computer Since 7:00 am. The main point of the response was to try to clarify the problem and to point out that the CCS team have comfirmed the problem and are looking into it. My apologies for the way that came out.

I do wonder if this is only in the ASP 3.0 Template Models?? The CCS team is looking into it though.

   


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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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