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

 [Resolved] Record Form Update Problem

Print topic Send  topic

Author Message
szenczi

Posts: 67
Posted: 07/14/2008, 10:04 AM

Hi,
I've got a record form with BeforeUpdate event:

//Custom Code @222-2A29BDB7
// -------------------------

$lezart = $tandij1->lezart->GetValue(); // Checkbox
$oradij = CCGetSession("oradij");

if ($lezart == 0){

$havioraszam = $tandij1->havioraszam->GetValue();
$havidij = $havioraszam * $oradij;
$pluszoraar = $tandij1->pluszoraar->GetValue();// Listbox
$pluszoradb = $tandij1->pluszora->GetValue(); // Textbox
$pluszoradij = $pluszoradb * $pluszoraar;
$kulonbozet = $tandij1->kulonbozet->GetValue(); // Textbox
$fizetendo = $havidij + $pluszoradij + $kulonbozet;

$tandij1->fizetendo1->SetValue($fizetendo); // Hidden field
$tandij1->havidij1->SetValue($havidij); // Hidden field
}

// -------------------------
//End Custom Code

By default, the lezart checkbox is 1.
When I erase the checkbox and submit, the fizetendo and havidij database fields will be 0! I use fizetendo1 and havidij1 controls for writing to the database. But, when I click again on the submit button, the form will send the correct values to the database.
I don't understand why?

Thanks,
Norbert
_________________
CCS5.1, PhP, MySQL
View profile  Send private message
quasimidi


Posts: 151
Posted: 07/14/2008, 2:23 PM

Sztem a baj az, hogy a form elküldése után adod meg a hidden mező értékét, ami pedig logikátlan dolog.
Használj js-t kliens oldalon a formon a hidden mező értékének módosítására!

Robert
_________________
RS
View profile  Send private message
szenczi

Posts: 67
Posted: 07/16/2008, 1:53 AM

Megmondom őszintén, nem teljesen értem, amit írtál.
Miért a form elküldése után adnám meg? Ugyanez a kód (az if nélkül) van a BeforeInsert-ben és ott tökéletesen müködik. Azon kívül itt, a BeforeUpdate-ben is csak azután nem müködik, csak a második submit-ra, mikor kiveszem a chekbox-ot. Tehát, ha nem volt benyomva és úgy küldöm el, akkor jó. Ezen kívül, miért 0 kerül be, mikor előtte volt már értéke a mezőknek az adatbázisból?

Köszi, Norbi

Ui: Nem orrolnak meg ránk, ha magyarul levelezünk itt?
_________________
CCS5.1, PhP, MySQL
View profile  Send private message
szenczi

Posts: 67
Posted: 07/17/2008, 5:50 AM

Some curiosity!

Whereas I couldn't solve this problem, I made another record form for this table. This was identical to the first form (I copied the custom codes too). The only difference is that the new one is only works in update mode and the new form is working!
Who knows why it is?

Norbert
_________________
CCS5.1, PhP, MySQL
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/18/2008, 2:53 AM

  
if ($lezart == 0)  

change it to

  
if ($lezart <> 1)  

As to only functioning in Updatemode....... you code is in BeforeExecuteUpdate.........

See if that helps you.
You checkbox is not set to 0 but rather to empty or NULL or Unchecked.
Testing for it to be not 1, is a good way to go around that.

Walter
(Please keep forum as english or spanish as possible, or ask yes to open thread in your language (what is it by the way))



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

Posts: 67
Posted: 07/22/2008, 6:05 AM

Thank you! It's working already.

(Yes, quite so! I continue in English, I don't think that too much hungarian user here.)

Norbert
_________________
CCS5.1, PhP, MySQL
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.