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

 Adding Button In Grid Template Vs. Hyperlink

Print topic Send  topic

Author Message
Suntower

Posts: 225
Posted: 08/11/2006, 3:16 PM

Hi,

This is related to a question I had way back when: http://forums.yessoftware.com/posts.php?post_id=56742

I have a typical Shopping Cart screen. It's just a Grid template with the items the user has ordered so there's nothing for them to 'enter'. All I need is for them to click either a 'Cancel' or 'Submit' button.

When I try to add these buttons to the page with the grid, the OnClick events do not fire. I guess this is because there are no fields for validation. Correct? How can I -force- these events to fire. I need to do two things when the button is pressed:
1. Run a SQL command
2. Redirect the user to another page

Now, I -could- use a hyperlink and that solves problem #2, but it doesn't provide a way to execute the SQL command.

So... Is there either:
a) A way to get the button to fire in a grid? (preferred) or
b) Be able to execute some server side code snippet when the hyperlink is clicked.

Yeah, I -know- I could pass a parameter to another page after the hyperlink fires and do the processing -there-, but I'd much rather keep the logic all in one place.

Thoughts?

THANKS!

---JC





_________________
---On a campaign for more examples and better docs!
View profile  Send private message
WKempees
Posted: 08/11/2006, 3:36 PM

You could add a recordform to the page underneath the grid.
run it on any table (preferrably "dual" or a "small" table, maybe even a
dedicated table just recording an ordernumber or so plus a date.
Put your needed SQL statement in the appropriate Execute(Insert/Update) et
voila.
Update would be the one to go for, but insert should be the default as the
record is nor primed.
redirection is then a breeze.

Hope this get's you on your way.


"Suntower" <Suntower@forum.codecharge> schreef in bericht
news:644dd01bbc7ac0@news.codecharge.com...
> Hi,
>
> This is related to a question I had way back when:
> http://forums.yessoftware.com/posts.php?post_id=56742
>
> I have a typical Shopping Cart screen. It's just a Grid template with the
> items
> the user has ordered so there's nothing for them to 'enter'. All I need is
> for
> them to click either a 'Cancel' or 'Submit' button.
>
> When I try to add these buttons to the page with the grid, the OnClick
> events
> do not fire. I guess this is because there are no fields for validation.
> Correct? How can I -force- these events to fire. I need to do two things
> when
> the button is pressed:
> 1. Run a SQL command
> 2. Redirect the user to another page
>
> Now, I -could- use a hyperlink and that solves problem #2, but it doesn't
> provide a way to execute the SQL command.
>
> So... Is there either:
> a) A way to get the button to fire in a grid? (preferred) or
> b) Be able to execute some server side code snippet when the hyperlink is
> clicked.
>
> Yeah, I -know- I could pass a parameter to another page after the
> hyperlink
> fires and do the processing -there-, but I'd much rather keep the logic
> all in
> one place.
>
> Thoughts?
>
> THANKS!
>
> ---JC
>
>
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Suntower

Posts: 225
Posted: 08/11/2006, 5:10 PM

Thanks, that's where I was heading. But that begs the follow-up question:

How does one 'prime' the record for the ASP template if one wants to use the Update button?

TIA,

---JC

Quote WKempees:
You could add a recordform to the page underneath the grid.
run it on any table (preferrably "dual" or a "small" table, maybe even a
dedicated table just recording an ordernumber or so plus a date.
Put your needed SQL statement in the appropriate Execute(Insert/Update) et
voila.
Update would be the one to go for, but insert should be the default as the
record is nor primed.
redirection is then a breeze.

Hope this get's you on your way.


"Suntower" <Suntower@forum.codecharge> schreef in bericht
news:644dd01bbc7ac0@news.codecharge.com...
> Hi,
>
> This is related to a question I had way back when:
> http://forums.yessoftware.com/posts.php?post_id=56742
>
> I have a typical Shopping Cart screen. It's just a Grid template with the
> items
> the user has ordered so there's nothing for them to 'enter'. All I need is
> for
> them to click either a 'Cancel' or 'Submit' button.
>
> When I try to add these buttons to the page with the grid, the OnClick
> events
> do not fire. I guess this is because there are no fields for validation.
> Correct? How can I -force- these events to fire. I need to do two things
> when
> the button is pressed:
> 1. Run a SQL command
> 2. Redirect the user to another page
>
> Now, I -could- use a hyperlink and that solves problem #2, but it doesn't
> provide a way to execute the SQL command.
>
> So... Is there either:
> a) A way to get the button to fire in a grid? (preferred) or
> b) Be able to execute some server side code snippet when the hyperlink is
> clicked.
>
> Yeah, I -know- I could pass a parameter to another page after the
> hyperlink
> fires and do the processing -there-, but I'd much rather keep the logic
> all in
> one place.
>
> Thoughts?
>
> THANKS!
>
> ---JC
>
>
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>



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


Posts: 1679
Posted: 08/12/2006, 3:46 AM

Aha, well I am not an ASPér, sorry.
But if you add a Newpage , do a Grid + Record on a test table, it will generate a grid with linked recordform.
the record form in update mode will have the record id on the URL (PhP), that is what I meant by Priming for update.

Now if you follow my previous direction you could have a table with just one record in it id, text 1,'X' and just select that record for update while your SQL is working on another table.
But as you intend to do an INSERT anyway why not do the reord on that table and modify the INSERT?
You can manualy edit the Buttons INSERT text to UPDATE or SUBMIT, in fact you can do anything you like to it, to build a 'smokescreen'
W.

_________________
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
Waspman

Posts: 948
Posted: 08/12/2006, 4:14 AM

I think I do a similar thing…

On one example I have a series of screens which present the user with options i.e.

1. They choose the forktruck they want
2. They select the types of mast
3. They add the options

At the start of the cart process a unique id is created and added to the record and saved as a session. The session as applied to the various stages for obvious reasons.

Then on the final summary page the session is used to display total order with necessary grids and a record form, presented with submit(update) or cancel (delete).

If the order is submitted a field in the original record is marked appropriately and any actions such as email notifications taken. If the user cancels the original and all other related records are deleted.

Is this the kind of thing you want to do?



Tony

I'm using ASP & SQL
_________________
http://www.waspmedia.co.uk
View profile  Send private message
Suntower

Posts: 225
Posted: 08/14/2006, 10:01 AM

FWIW, if there are any travellers out there as paradigm challenged as I have been.

Here is the answer, kids....

PRIME THE FORM! The form has to be primed in order for the buttons to do -anything- or for the Submit button to be visible.

And how does one -prime- a form?

By assigning a value in the WHERE clause of the SQL Query.

IOW: Unless the form template code 'sees' that a record has been fetched in the Dataset, it will not display the Submit button.

It makes sense, I guess, BUT I sure wish this essential concept was better explained in the tutorials!!!!

May this help someone as thick as myself.

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


Posts: 1679
Posted: 08/14/2006, 10:38 AM

8-)
So, in short, you solved it then?

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

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.