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 -> PHP

 Refresh form before Update

Print topic Send  topic

Author Message
rado

Posts: 221
Posted: 07/17/2009, 8:03 AM

HI,
I have editable grid which contains for example 3 fields:
1. price one
2. price two
3. total price (price one + price two).

I added in before show of "total price" field, calculation - price one + price two. It works just fine.

The problem that I have is that when I I click on "Submit" button my table is updated with values of fields before I change them. If I click one more time on "Submit" button the new values are inserted into the table.
Does anybody knows any trick how I can refresh my form before update action is happened, so I can achieve same task in just one click on "Submit" button.

Since this is editable grid it's for me difficult to use Client side actions.

Please help if you can?

Thanks,

Rado
View profile  Send private message
damian

Posts: 838
Posted: 07/18/2009, 4:30 AM

rado - i dont follow what you are saying.... if you are doing your calculation in before show then all new rows are going to have 0 for total price
perhaps you can do an after insert calc as well?
another option is to only store price one and price two in the database and your sql can be something like
select price1, price2, price1+price2 as totalprice from mytable where 1
that way you will display total price for existing records and your last record will not be missing its total price...

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
tcb

Posts: 34
Posted: 07/18/2009, 2:28 PM

Quote rado:

Since this is editable grid it's for me difficult to use Client side actions.


That's what I used to think. The trick is to create unique IDs for the row elements you want to work with, e.g., insert something like

id="Textarea1_{EditableGrid1:rowNumber}"

into the HTML element within the Row block, using the appropriate rowNumber variable name.

You can use the {EditableGridName:rowNumber} syntax on as many elements as you like, but put some string along with it to identify the element within the row. Javascript will then have access to every individual element in every row via getElementById(). You probably will have to define the event actions by hand, as the CCS client-side events only fire once AFAIK. (Could be wrong there.)

Hope this helps.
View profile  Send private message
rado

Posts: 221
Posted: 07/18/2009, 2:54 PM

Thanks a lot tcb,

Few hours ago I just finished workaround for my problem. I know it's not the best but it works. I made additional button in editable grid which will refresh the form with new changes and after that click on "Submit" button will update the database.

Thanks again for your interest to help me. If I didn't resolve this problem I would definitely use your solution.

Rado
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.

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.