CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Dynamically Redirect Users to Another Page

Print topic Send  topic

Author Message
Suntower

Posts: 225
Posted: 12/16/2004, 2:27 PM

I want to send users to a page when they hit 'Submit'.

In the docs it says that one simply needs to assign the Redirect variable in the onclick event for the Submit button

Function Form1_Insert1_OnClick() {

Redirect = "InsertMessagePage.asp"

}

...for the life of me this does not work. The form does -nothing-. It appears that one has to assign the Redirect variable in the Form Operation method (at least that's what the appgen does if you assign a Return Page).

Why is this not working? This must be a 'web vs. non-web' developer thing because there seem to be a number of things that -should- work and I can't figure out why they don't.
_________________
---On a campaign for more examples and better docs!
View profile  Send private message
mrachow


Posts: 509
Posted: 12/16/2004, 2:42 PM

Are you redirected to another page or do nothing happens?
_________________
Best regards,
Michael
View profile  Send private message
peterr


Posts: 5971
Posted: 12/16/2004, 3:08 PM

I just tested this example and it worked for me, however it probably requires that the "Operation" property of that button is set to Insert/Update/Delete and its's possible that such operation needs to happen successfully (for example Insert or Update) before the redirect is performed.
BTW, did you use Server or Client OnClick?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Suntower

Posts: 225
Posted: 12/16/2004, 3:10 PM

It simply stays on the page.

Again, if I insert my own code in where the appgen would, it does work. But the whole point is for me to learn how to use the events so I don't screw up the appgen code.

FWIW: I tried this in the onclick event for both the server and the client side. Same results each way.

TIA,

---JC


Quote mrachow:
Are you redirected to another page or do nothing happens?

_________________
---On a campaign for more examples and better docs!
View profile  Send private message
Suntower

Posts: 225
Posted: 12/16/2004, 3:14 PM

---The button is Submit and the options are Submit or Cancel. Any other ideas? This -should- be simple, right?

All I want to do is to return to the page I called from -without- screwing up the appgen code. I mean, I can get this done if I overwrite the appgen, but that teaches me nothing about how this all works.

Thanks,

---JC


Quote peterr:
I just tested this example and it worked for me, however it probably requires that the "Operation" property of that button is set to Insert/Update/Delete and its's possible that such operation needs to happen successfully (for example Insert or Update) before the redirect is performed.
BTW, did you use Server or Client OnClick?

_________________
---On a campaign for more examples and better docs!
View profile  Send private message
peterr


Posts: 5971
Posted: 12/16/2004, 3:19 PM

OK, but what value is selected in the "Operation" property of that button?
And, is the record submitted successfully and updated in the database?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
peterr


Posts: 5971
Posted: 12/16/2004, 3:21 PM

Also, the "Return Page" property of the button (not the form) should be blank for this custom event code to work.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Suntower

Posts: 225
Posted: 12/16/2004, 4:29 PM

---I have tried Submit and <blank>. No joy.

AFA the record being submitted, how would I know? I am not doing any updates, I just want the frickin' page to close and return from whence it came.

And if the ODBC driver -did- post an error, wouldn't that show up in the error message @ the top of the form?

Getting, kinda frustrated. Mainly because I'm sure it's something REALLY minor but there just doesn't seem to be any -easy- way for me to troubleshoot, besides this incredibly tedious back and forth.

Thanks for trying...

----JC


Quote peterr:
OK, but what value is selected in the "Operation" property of that button?
And, is the record submitted successfully and updated in the database?

_________________
---On a campaign for more examples and better docs!
View profile  Send private message
peterr


Posts: 5971
Posted: 12/16/2004, 4:47 PM

But there is no "Submit" value in that property listbox...
The only valid values that I see there are: Insert, Update, Delete, Cancel, Search.

You can check your database to see if the record was updated after you changed some value for example. Only if the operation was successful then the form will proceed onto the next step, which is page redirection.

The error would usually be shown somewhere on the page.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Suntower

Posts: 225
Posted: 12/16/2004, 6:38 PM

OK at this point I -have- to ask: Am I using the same version as you?

I am using 2.3.2.24

When I go through the Order Entry tutorial (but using my db) I created a record builder for the master record. No problemo.

I then create an Editable Grid and though I told it to create a Add/Edit/Delete it ONLY creates a Submit button. And that Submit button can only have a Submit or blank operation.

What could be going on?

---JC


Quote peterr:
But there is no "Submit" value in that property listbox...
The only valid values that I see there are: Insert, Update, Delete, Cancel, Search.

You can check your database to see if the record was updated after you changed some value for example. Only if the operation was successful then the form will proceed onto the next step, which is page redirection.

The error would usually be shown somewhere on the page.

_________________
---On a campaign for more examples and better docs!
View profile  Send private message
peterr


Posts: 5971
Posted: 12/16/2004, 10:38 PM

I see. Didn't know that you were using the Editable Grid. There may be some other unknown variables so I recommend contacting the support and later attaching your page that doesn't work.
I just tested that example and worked perfectly for me. In the "Submit" button's OnClick event I entered
Redirect = "http://www.google.com"
I also recommend that you delete the ASP code for that page (OrderEntry.asp) and let it regenerate when you publish the next time.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
nebde


Posts: 3
Posted: 12/21/2004, 1:34 AM

Hi there, Tried to follow your discussions.
Using redirect dynamically is nice got some experience with it on my previous projects.

For Insert operation you can use the AfterExecuteInsert event to redirect it to another page. Same with update on AfterExecuteUpdate and with delete on AfterExecuteDelete.

In case of Errors and want to redirect the user to another page, use the OnValidate Event and fires it when an error occurs.
Example :

Function Form_OnValidate
With Form
If IsEmpty(.Textbox1.Value) then
Redirect = "YourPage.asp"
End If
End With
End Function
8-)



_________________
Regards,
nebde
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.