CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 add a NEXT button is search form

Print topic Send  topic

Author Message
stephenlau

Posts: 13
Posted: 07/13/2008, 8:02 PM

Dear all,

I have built a search form with SEARCH BUILDER and would like to add a NEXT button to look up the next record. My form name is "voucher" and have a textbox "voucher_no" and a search button "Button_DoSearch".
I have added the server OnClick event to the Button_DoSearch with code:

$voucher->voucher_no->SetValue( $voucher->voucher_no->GetValue() + 1);

the type of the textbox is integer.
it does not work, nothing happen when button is clicked. What's wrong with it?
Or, how can I add a NEXT button in the search form to display the next record?
thanks so much.

Regards,
Beginner Stephen
_________________
.
View profile  Send private message
mrachow


Posts: 509
Posted: 07/14/2008, 1:06 AM

It isn't that easy.

You would have to build your query for the record form using a session variable, a form variable , or an URL parameter for getting a certain ID for your current record.

After changing it you have to reload the page to initiate the select and the showing of the next record.
_________________
Best regards,
Michael
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/14/2008, 1:07 AM

Stephen,
First:
You have double posted this question in the forum 'programming', could you delete your post there please.
Also it is no forum rule but [How to] and [Resolved] is sort of what we use when a question is resolved to indicate it as resolved, note the [ ].

As to your question,
A search form is just that, it is a form for collecting the search parameters from the user, when you press the 'search' button the search form will 'redirect' to the resultpage you defined.
The resultpage can be the same page or another page containing a grid (for instance), that grid will display it's data filtered by the search parmeters it receives.
The filtering is done and can be changed in the result grid's DataSource Where parameters.

I am guessing that your page is a search and a grid in one, as generated by default by the builder, and that your intended operation is:
User enters 1234 in search field voucherNo, presses search and the grid displays all rows with voucherno >= 1234, from you post I guess you set Grid rows to 1, so only one row is showing with voucherno 1234.

You then want a Next button on the Search form that the user can click to have the grid show the next voucherNo.
If your grid is standard generated (and all my above assumptions are true) your grid will aready have navigation buttons in it's bottom row, which will allow you to do next/previous and so on.

There are several ways to accomplish exatly what you posted, but to do that It would be nice if you could respond to the above and tell what exactly you need and we will take it from there.

The code you wrote in the search form will not function.

Walter




_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/14/2008, 2:37 AM

As to deleteing posts:
There should be a delete checkbox available to original poster only, when you edit your post.
I cannot post this text in that forum thread as it will make the delete unavailable to you.
So open your post there dor edit and look for 'red cross delete', assume you are logged into forum and not using external reader, other option is to change the text to [deleted] + link to this thread.

Walter
I will delete this content later.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
stephenlau

Posts: 13
Posted: 07/14/2008, 2:41 AM

thank you very much.

In fact I now have a search grid from SEARCH BUILDER and a record grid from RECORD BUILDER. So, when I enter a number in the search box, only one particular record will be shown in the record grid. What I exactly want to add is a PREV and NEXT button which allows me to display the prev/next record in the record grid when button clicked.
The search grid name is "voucher" and has a textbox "s_voucher_no" on it.
The record number is incremented and decremented.

I add the following code to the server OnClick event on the search button but does not work.
{
$current_voucher_no =$voucher->s_voucher_no->GetValue();
$voucher->s_voucher_no->SetValue($current_voucher_no+1);
}

I expect the search box will auto fill in a incremented voucher no.
Is it the only way to session to pass the incremented number and add a before show events in the resulting page?

Thanks a lot

Stephen


_________________
.
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/14/2008, 2:47 AM

Stephen,
http://examples.codecharge.com/ExamplePack/NavRecordGrid/NavRecordGrid.php
Have a look at this example, see if it does it for you, I expect it does.

It does what you want but changes the way you look at the problem.
In short it is a record grid, showing one record at a time.
It is initiated by the search form, shows the one record row, and offers navigation (prev/next)
The grid however is altered in such a way that it reflects the recordform lay-out.
Update Insert and add are handled by a 'real' form.
Have a look at the example see if you like it, it will save you a lot of time.
Building what you want is also possible but more complicated.

Walter
(double post again my friend, lol)
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
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.

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.