CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 POST instead of GET (Link parameter)

Print topic Send  topic

Author Message
Karen
Posted: 06/08/2003, 10:57 PM

In CC, you could set the form to transfer parameters via POST/GET method. How do you do that with CCS?

I am transferring the user id via a link control but there isn't anywhere where I can set the transfer method. Using GET is not possible since the user can change the parameter in the URL and access/update others' user information.

Pls help. TIA!
rrodgers
Posted: 06/09/2003, 9:56 AM

Right click inside the form tags and choose "<form> Properties" from the popup menu. You can change the method of submiting the form there. I havn't tried it so I cannot tell you the results.

rob
Karen
Posted: 06/09/2003, 6:22 PM

Thanx for your suggestion, Rob. However, the Form properties is already using POST method. Somehow the link is still being transferred in the URL. Perhaps the post method for the form is only for the submit button and not the link. Is there any way to control the link? Any ideas?

TIA!
rrodgers
Posted: 06/09/2003, 6:26 PM

There are two properties on the form data properties.
"preserve parameters" and "remove parameters"

Play with these. Remove parameters can be a semicolon separated list.

rob
Karen
Posted: 06/09/2003, 7:23 PM

If I remove the parameter, then it is the same as not passing the reference page the parameter. I have tried this and just used the session id as a criteria for the next page which is a maintenance page for the user. However, if there is an error, the error message is displayed with blank record since there are no parameters to preserve. If I can get the criteria (session id) to be preserved when an error occurs, then I have no need to pass the parameter at all.

Any ideas? TIA!
rrodgers
Posted: 06/09/2003, 7:37 PM

If your users are logging in and you are using the userid to retrieve the user record why not try one of these.

CCGetUserLogin()
CCGetUserID()

You don't have to pass these as they are aleady session variables. You only need to setup the form to use them.

rob
Karen
Posted: 06/09/2003, 7:52 PM

How to preserve these session variable on error? I did try to use the UserID session variable but if an error occurs like if the user does not enter matching passwords when trying to change password, the resultant record is blank.

I put the criteria for the record form in the query. Have I left out anything? Thanx for your help!
rrodgers
Posted: 06/10/2003, 5:41 AM

>>How to preserve these session variable on error?
<snip>
>>if an error occurs like if the user does
>>not enter matching passwords when trying to change
>>password, the resultant record is blank.

I have never noticed that the session variables are cleared on error. Can you document this by "print"ing the session variable at the top of the page.

Maybe posting some of your code will also help.

rob
Karen
Posted: 06/10/2003, 8:18 AM

I'm not sure which part of my code I should paste here. But I'm guessing it has got to do with the criteria I've specified. I have specified it as such:

Condition type: Parameter
Field: member_id
Condition: equals
Parameter source: UserID
Source: Session

With the above, I get the record retrieved without any problems but on error, it disappears.

Perhaps I should have specified the condition type as an expression but how should the syntax be?

Thanx for the advice!
rrodgers
Posted: 06/10/2003, 12:39 PM

I am not sure what is going on with your session variables. I have never had mine clear unless my session times out. I have seen sessions variables not set if your security is too high and it prevents cookies. Or if you are running Norton AV and have script blocking enabled, or sometimes the zonealarm family of programs interupts the cookies also.

You mention an error... Can you describe in detail what error and how the error was caused?


This is what I would use for getting the userid from the session.

Condition type: Parameter
Field: member_id
Condition: equals
Parameter source: CCGetUserID()
Type: Expression


rob
Karen
Posted: 06/10/2003, 6:14 PM

The session variable isn't really cleared but it just doesn't seem to get retrieved in the criteria on error. When I said on error, I didn't mean code error, I meant that the OnValidate event triggered an error, i.e., the user entered passwords that do not match.

>Condition type: Parameter
>Field: member_id
>Condition: equals
>Parameter source: CCGetUserID()
>Type: Expression

Thanx, Rob, I've tried your suggestion above but with the same results.

I think I should post some code here but not sure which part to extract. Pls help. Thanx!
rrodgers
Posted: 06/11/2003, 11:36 AM

I am not sure either.

Can you break it down into a small one or two page project using Access/mssql (Could also use MySQL but I may need help makeing sure it was setup correct.)
and post it somewhere with a link?

Let me know.
rob
Karen
Posted: 06/11/2003, 6:17 PM

I realise it has to do with the onvalidate event that I coded. Because I also have input validation on the email and if that triggers an error, it is ok, i.e., the session userid is still maintained but not when an error is triggered by the password onvalidate event.

I hope that gives you a clue to the problem. I will now make it into a one page project and post the link when I'm done. Hopefully, that will give an insight to the problem. Thanks so much!
glerma
Posted: 06/11/2003, 8:36 PM

Boy. I'm confused as to what you are trying to accomplish here. I read your posts, but just don't get it.

Please provide the scenario and goals of your page in an outline or step-by-step instruction.
Karen
Posted: 06/11/2003, 8:40 PM

Ok, here's the link:
http://www.awes2001.com/testsite/testmember/Login.php

After logging in, you can try to put an invalid email and that will trigger the input validation error. You will notice that the Label field Login is still there.

But if you try to enter a password which does not match, this will trigger the validation and you will notice the Label field Login disappearing!

And this is the code in the events.php (hope someone can shed some light on this):

<?php
//BindEvents Method @1-7CFB8EB6
function BindEvents()
{
global $members;
$members->member_password->CCSEvents["OnValidate"] = "members_member_password_OnValidate";
}
//End BindEvents Method

//members_member_password_OnValidate @10-CA33BB50
function members_member_password_OnValidate()
{
$members_member_password_OnValidate = true;
//End members_member_password_OnValidate

//Declare Variable @17-B09E0B71
global $old_password;
$old_password = "";
//End Declare Variable

//DLookup @18-43272ABF
global $DBtest;
global $old_password;
$result = CCDLookUp("member_password", "members", "member_id=".CCGetUserID(), $DBtest);
$result = strval($result);
$old_password = $result;
//End DLookup

//Custom Code @19-E04EB0A1
// -------------------------
global $members;
// Write your own code here.
// Only perform the following if the password is updated
if ($members->member_password->GetValue() <> $old_password)
{
// Check that new passwords match before md5 and updating
if ($members->member_password->GetValue() <> $members->member_password_conf->GetValue())
$members->Errors->addError("Your passwords don't match!");
else
$members->member_password->SetValue(md5($members->member_password->GetValue()));
};
// -------------------------
//End Custom Code

//Close members_member_password_OnValidate @10-CC46CF8F
return $members_member_password_OnValidate;
}
//End Close members_member_password_OnValidate


?>
glerma
Posted: 06/11/2003, 9:51 PM

One question...

How are you populating your Label? From the Form Query or by populating the label with your session variable LoginName?
glerma
Posted: 06/11/2003, 10:00 PM

Actually. I found your problem....


I was able to replicate your scenario using my own site. I have a similar page called "My Account" where you can change profile, password, etc...


It seems you are retrieving your User Name from the initial database SELECT statement when the page first loads. Then I would assume your Label Control is populated from the results of that query.

If you want to be able to keep your User Name showing up, do the following...

1. Take out the User Name Column from your intial query. You really don't need it, unless you want to allow the user to change his/her own username.

2. Instead, just put in your Label Properties Default Value Option CCGetUserLogin()
This will then populate the form with the current logged in user's User Name.

This will work for you.


Now why did the UserName disappear???

Well, that's kind of hard to answer myself, but I would guess that it has something to do with the Label Control's Characteristics or maybe it's a genuine bug. I will have to play around some more to see.

Hope that helps Karen.

Regards,
George.
Karen
Posted: 06/12/2003, 12:25 AM

You're right on the spot! Thanks so much.

But I'm still wondering if I ever need to pass a link parameter via POST, if that's possible with CCS?
rrodgers
Posted: 06/12/2003, 6:38 AM

Hi Karen,

Success Finally<G>

rob
glerma
Posted: 06/12/2003, 12:37 PM

If your only concerned with editing only the currently logged in user, then you don't need to pass any link parameters around containing the user_id. If you are editing someone else's then yes you do. You can set up link paremeters in the Href Source Property of the Link Control.

   


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.