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 -> ASP

 Update Maintenance form Field on Button click

Print topic Send  topic

Author Message
PShearing

Posts: 6
Posted: 03/08/2006, 8:28 AM

It's the simple ones that seem to get me every time.

I'm using CCS 3, ASP, SQL2000. When a user clicks on a form button, I want to clear the content of a particular text field that is on a maintenance form (i.e. currently displaying a database field), and, it goes without saying, update the database field either immediately or when the form gets submitted.

I have introduced a new Forms Button (Named Button1). that is of type [Submit] The first point is that if I add a server-side OnClick event for this button, and hook it up to it's event handler( i.e. declare it within the class, add a CCCreateButton call and add it to the Controls object by including Button1 in the CCCReateCollection call), it never seems to get triggered. However, I can intercept the click in the "Operation" Subroutine and can identify the button and act accordingly. For completeness, my code in sub Operation is reproduced below:

If PressedButton = "Button1" Then
WriteToFile "C:\ASP_TEST.txt", "Button1-Click Before Change: [" & DB_LogonIPaddresses.Value & "]", True
DB_LogonIPaddresses.Value = ""
DataSource.DB_LogonIPaddresses.Value = ""
WriteToFile "C:\ASP_TEST.txt", "Button1-Click After Change: [" & DB_LogonIPaddresses.Value & "]", True
ElseIf .....

WriteToFile is a small function that appends text to a file for debugging purposes. If I look at this file I can see that prior to clicking the button, the field has a value and after reassignment it is an empty string, but throughout, the original field value remains on the screen and if I navigate away from the page and then back again, I can see that the value in the database has not been updated.

I've also tried to see what is going on when the user clicks on a "Clear" link (added to a Search form from the Advanced options menu) - but it looks like voodoo to me,

What , please, am I doing wrong? I have also tried HTML and JavaScript solutions (i.e. Client-side scripting) but these did exactly the same. Also, any ideas why the client-side OnClick event does not seem to be working? The BindEvents() function is being invoked. I seem to remember reading a throw-away line on one of the ASP threads that Field values are not available from server-side OnClick events. (?)

I've now spent hours failing to achieve something that would take one line of code and less than 30 seconds in Delphi/Access/VB, not that I'm blaming CCS - it's the clunkiness that comes from trying to make web pages do what they were never originally designed to do. Nonetheless, it is frustrating...

Kind regards

Paul :-/ It's the simple ones that get me every time!
_________________
Eschew Obfuscation
...Anon
View profile  Send private message
Paul Shearing
Posted: 03/08/2006, 9:38 AM

Sorry, in penultimate full paragrapgh it should read:

...Also, any ideas why the server-side OnClick event does not seem to be working?

Paul
Paul Shearing
Posted: 03/08/2006, 5:09 PM

Ok guys (and guys-esses), I've found the solution.

Replace the code in the Operation subroutine above with:

DB_LogonIPaddresses.Value = ""
UpdateRow()
Redirect = ""

UpdateRow flushes the change to the server and performs a screen refresh so there is no need to perform another redirection. Hence, we set the variable Redirect to an empty string.

Sorry to have cause any head-scratching out there - although I would still be interested to know why I can't get the server-side OnClick event to work for a Forms button.

I'm now a happy bunny.

Paul 8-)

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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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