CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Insert and Update editable fields different: how??

Print topic Send  topic

Author Message
Teufel
Posted: 01/27/2002, 4:30 AM

Hi!

Some preliminars:

I have 2 tables in my database with a 1-N relationship. The records created on the 'N' side shall not be deleted, nor have its foreign key altered in any way.

An example: 'father A' has 'child A1' and 'child A2', and 'father B' has no children. What I shall avoid is the case where I would change lets say 'child A1' to be from now 'child B1', thus changing its 'father'.

I shall certainly create some constraints at database level, but I don't want to have any database error messages being print out at my users browser, so I should avoid that at the application level.

That said, I come to my problem:

The solution I thought is to make 2 different 'masks' for the INSERT and UPDATE records (turning the foreign key field uneditable on the latter), but I have found no way in CC to create different 'input masks' for the INSERT and for the UPDATE records. I believe I could do that with Javascript (disable the field entry) before the record gets shown, but that would fail if my user does not have Javascript enabled.

The more secure solution I thought was to make two different forms, one used to show the details of the 'sons' and which would show the foreign key value (father), but let it uneditable, and another INSERT form which would let me choose the desired father from a list box. Anyway, CC also creates automatically the link to the INSERT record as being the same page as UPDATE record.

Should I have to create another 'menu form' with just one entry (a URL) linking to the INSERT record page and choosing not to let the user make inserts with my UPDATE record?

Hope I was not too confusing,
TIA,
Teufel
Nicole
Posted: 01/28/2002, 4:51 AM

Teufel,
you may restrict the parent name listed in ListBox field when the record is updated. Create ListBox field based on custom sql. E.g.:
ASP
select primary_key_field, showing_field from table name " & restrict &"
PHP
select primary_key_field, showing_field from table name " . $restrict ."

In Before event check he value of passed primary key field of child table (let name it ID.). If it empty all names from parent table could be listed, if not, the list should be restricted. Sample code:
ASP
if isEmpty(pPKID) then
restrict = ""
else
restrict = " WHERE primary_key_field=" & fldforeign_key_field
end if

PHP
if ($pPKID == "")
$restrict = "";
else
$restrict = " WHERE primary_key_field= " . $fldforeign_key_field;


   


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.