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

 Replace Control Value Before Inserting

Print topic Send  topic

Author Message
szenczi

Posts: 67
Posted: 02/25/2008, 4:48 AM

Hi,

I'd like to create a custom field in my database, which is composed in runtime. I put my code in the BeforeInsert event but I can't get any valid data from the record's text fields. (My variables are empty.) It seems as the fields can't get value yet (but the form is filled in).
What's would be wrong in my code?
(I use GetValue() function in my php code.)

Thanks,
Norbert

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


Posts: 1679
Posted: 02/25/2008, 5:04 AM

Show your code here.
Also supply names of the page/form/textfields.
We might be able to help.

_________________
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
Posted: 02/25/2008, 5:10 AM

Afterthought,
Do it through the CustomInsert????
Walter

szenczi

Posts: 67
Posted: 02/25/2008, 5:19 AM

Record: tanfolyam
Text Box: kezdido
Hidden: oratip_kod
Label: tanfkod


function tanfolyam_BeforeInsert(& $sender)
{
...
$kezdido=$tanfolyam->kezdido->GetValue();
$kod="$kezdev";
$kod.="/";
$tipus=$tanfolyam->oratip_kod->GetValue();
$kod.="$tipus";
$tanfolyam->tanfkod->SetValue($kod);

return $tanfolyam_BeforeInsert;
}

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

Posts: 67
Posted: 02/26/2008, 12:29 AM

Quote wkempees:
Afterthought,
Do it through the CustomInsert????
Walter


Yes, I use the CustomInsert. Inserting of the row is ok, but the field values (so the value) are incorrect.
_________________
CCS5.1, PhP, MySQL
View profile  Send private message
wkempees


Posts: 1679
Posted: 02/26/2008, 5:43 AM

1: Use echo($tanfolyam->kezdido->GetValue()) to see content of variable.
2: The field is not by any chance a hidden label? hidden fields are not posted.
3:using $DB<Connectionnam>->Debug = true; will display the generated SQL

Hope this helps.
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
szenczi

Posts: 67
Posted: 02/26/2008, 6:12 AM

The contents are very interesting:
kezdido = 'Array' and the oratip_kod is empty.

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

Posts: 67
Posted: 02/26/2008, 6:17 AM

2: Yes, if the label is hidden I can't get the value of this field.

But I don't understand why get kezdido the 'Array' value?
_________________
CCS5.1, PhP, MySQL
View profile  Send private message
wkempees


Posts: 1679
Posted: 02/26/2008, 6:20 AM

Ok
So kezdido, what is it? a date field by chance?
which one is the hidden field, in designer unhide it, see if that brings result.
As a quick test.
Walter
Hidden fields are never posted, so you could define a global or session variable to hold its value instead of hidden field.

_________________
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: 02/26/2008, 6:27 AM

Yes, the kezdido is a date field with a popup date picker.
_________________
CCS5.1, PhP, MySQL
View profile  Send private message
datadoit
Posted: 02/26/2008, 6:29 AM

wkempees wrote:
> 2: The field is not by any chance a hidden label? hidden fields are not
> posted.
> ---------------------------------------

Au contraire monsieur. Hidden fields are indeed posted with forms.
datadoit
Posted: 02/26/2008, 6:31 AM

szenczi wrote:
> 2: Yes, if the label is hidden I can't get the value of this field.
> ---------------------------------------

You can use CCGetFromPost("YourHiddenField","") to get it's value.
wkempees


Posts: 1679
Posted: 02/26/2008, 8:06 AM

So, including DataDoit'sremark, which is correct, you should in my opinion
1: not have any code in BeforeInsert
2: Using the CustomInsertProperty, type Table, press [...] and fill in the blanks.
Select the correct fields against the database, let CCS do all the hard work
AND for the HiddenField use type FORM and name is the name of your hiddenfield.
Same for Update if needed.

I say this because at this moment you only have code in beforeInsert that tells you what content there is and we would have to explain to you how to assign the values to the SQL also explaining how to typeconvert things.
Which is not hard but just a lot of work. the above method is far faster easier and CCS compliant.

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
szenczi

Posts: 67
Posted: 02/27/2008, 5:34 AM

Thank you! Your help was useful for me.
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.

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.