CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 changing control depending on form mode

Print topic Send  topic

Author Message
Posted: 12/12/2003, 3:06 AM

Still new to CodeCharge and find it difficult to move away from pure line based PH to CC...

I have a table with two columns: test_key (primary key and unique) and test_data
I have a maint form that allows the user to either add or modify the record.

Once the record is added the user cannot change the value on the key. What I have done to accomplish this is to set the contro (test_key) to $form->test_key->Visible = false;

This works except for the fact that when the submit button is hit I do not have any value in the test_key and the record is writtem with the value of NULL in test_key?

How do I retrieve the value of test_key after the select and how do I set the value of test_key to this saved value before the update??

I have tried nearly everything and I must say I've run out of ideas!!! I'm sure it's simple and I'm just missing something here!!

Thanks in advance for all suggestions.

Posted: 12/12/2003, 4:14 AM

I belive you should be using a hidden field to accomplish your goal. I think setting the visible property for the field eliminates it from the recordset.
Posted: 12/12/2003, 8:13 AM


Thanks, I have worked that one out already although that does not fix the problem:

Problem being the field must be as follows:

1. IN ADD MODE - textbox
2. IN EDIT MODE - hidden textbox (aaddtional label field to purely display the test_key)

The question I guess is how to change a textbox to a hidden text box dynamically or programatically??

Posted: 12/15/2003, 6:40 AM

It is a bit tricky, but of course it is possible.
Use Label control assigned to the necessary table field.
In the Before Show form event check the formís mode (add or edit) and assign necessary HTML code to the label (do not forget to set its Content property to HTML). Here is sample code:

If ($form_name->EditMode)
$form_name->Label1->SetValue("<input maxlength=\"50\" size=\"50\" value=\"".$form-name->Label1->Value ."\" name=\"field_name\">");
$form_name->Label1->SetValue("<input type=\"hidden\" value=\"".$form-name->Label1->Value ."\" name=\"field_name\">");

Note that "field_name" should be the same in both cases and preferable match the label name. In this case you can create Custom Insert and Update for the form and include the "field_name" field into the queries


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

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