CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Is there a way of not having a query string upon submitting a search form?

Print topic Send  topic

Author Message
GeorgeS

Posts: 206
Posted: 09/28/2010, 2:51 PM

Hi,
I always wanted to be able to configure Search Forms that CCS generates for grids the way that plain HTML forms are when using POST method.

I can't figure out if it is possible not to have URL params displayed upon submitting the form.

Another question is:
Why can't I get any values of submitted controls through
$_POST['s_control'];
CCGetFromPost("s_control","");
even if in Format (HTML) properties the method is POST and in Data Properties Preserve Parms are:GET and POST


(Of course, CCS grids are working fine with URL or Form params ...)
_________________
GeorgeS
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 09/29/2010, 5:37 AM

Hello,

I made myself the same question some days ago:

http://forums.codecharge.com/posts.php?post_id=112683

Quote GeorgeS:
Hi,
I always wanted to be able to configure Search Forms that CCS generates for grids the way that plain HTML forms are when using POST method.

I can't figure out if it is possible not to have URL params displayed upon submitting the form.

Another question is:
Why can't I get any values of submitted controls through
$_POST['s_control'];
CCGetFromPost("s_control","");
even if in Format (HTML) properties the method is POST and in Data Properties Preserve Parms are:GET and POST


(Of course, CCS grids are working fine with URL or Form params ...)

_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
datadoit
Posted: 09/29/2010, 6:11 AM

If you don't mind having 'ccsForm' in the URL, then:

1. For your search form, set it up with a connection and choose a data
table to associate it with. Can be any table - doesn't really matter.

2. Change the Search button's operation from Search to Insert.

3. For the search form's BeforeInsert event, add custom code:

$Container->InsertAllowed = false;

4. In the results grid, you now have access to CCGetFromPost(). Use
them in your grid WHERE parameters.

If having 'ccsForm' in the URL is mind numbing for you:

1. In the search form's BeforeInsert event, put your post or search
parameters into session variables.

$Container->InsertAllowed = false;
CCSetSession("s_field1", $Container->s_field1->GetValue());

2. In the results grid, check for those session values via
CCGetSession("s_field1").

3. In the results grid BeforeShow event, add:

if (CCGetParam("ccsForm") ) {
global $FileName;
header("Location: " . $FileName . "?" .
CCRemoveParam(CCGetQueryString("QueryString",""), "ccsForm"));
exit;
}
GeorgeS

Posts: 206
Posted: 09/29/2010, 12:00 PM

Thank you data!

I appreciate you input!

Don't you think that it is somewhat strange that CCS search form has a choice of GET & POST methods under Format tab but always uses GET ?
What is different when under the Data tab I select none, Get or Get and Post?

In order to put RESOLVED status to this post I'd like to know from Yes if these properties are enabled at all for Search forms.

_________________
GeorgeS
View profile  Send private message
gingercat

Posts: 48
Posted: 10/08/2010, 6:21 PM

Actually that's an interesting question I have always wondered too. But you're right whether you select GET or POST makes no difference. What's that all about?
View profile  Send private message
andrewi

Posts: 162
Posted: 10/10/2010, 11:46 AM

Actually, it does make a difference. If you look at the html, the <form> tag will change between GET and POST. However, the next page is always requested by the GET method (URL + parameters) so it looks like there's no change.

There's an important functional difference. If you want to use server-side validation on the search form fields it will only work with the POST method. If you use the GET method, the search form validation events won't be executed

Say you have a date field in your search form. With the POST method, if you enter an invalid date you'll get the normal error messages and you'll have a chance to correct it. With GET method, there's no validation, and the badly formed date you enter will be passed direct to the target form (e.g. your data grid) - possibly causing an error.

So normally it's best to use the POST method on search forms. If it's impossible to enter a wrong value - for example, if the search form consists entirely of combobox selectors - then you could use GET safely (and this will lead to one less iteration of the page's code).

That, at least, is how I understand it - after a bit of confusion.
View profile  Send private message
datadoit
Posted: 10/10/2010, 5:19 PM

Well put!

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.

Web Database

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.