CodeCharge Studio All ASP PHP Perl ColdFusion Java C#.NET VB.NET

Dynamic Login Field in a Registration Form

This example shows how to use a Login control on a registration form.

Assume that you have a Registration Record form with a Logi nText Box control where users can enter a Login name when creating a record

but existing users should not be able to change the Login name

  1. Create a registration form.
  2. Click on the Text Box icon in the Forms tab of the Toolbox to add the Login Text Box control. In the same tab click on the Label icon to add a Label control directly after the Login Textbox.
  3. Set the name of the Label control to Login_View.
  4. Add <!-- BEGIN TextBox Login --> at the beginning and <!-- END TextBox Login --> at the end of the Login Textbox.
  5. Add <!-- BEGIN Label Login_View --> at the beginning and <!-- END Label Login_View --> at the end of the Login Label.
  6. The illustration below shows how the Login will look:
  7. Add a Before Show event for the Record form.
  8. Within the event, add the code below:

PS: Don't forget to retrieve the login value in the edit mode


Function Registration_BeforeShow(Sender)

  If (Registration.EditMode) Then
      'Edit Mode
      'Add Mode
  End If

End Function


function Registration_BeforeShow(& $sender) {
global $Registration;

  if ($Registration->EditMode) {
      //Edit Mode
      $Registration->Login->Visible = False;
  } else {
      //Add Mode
      $Registration->Login_View->Visible = False;



sub Registration_BeforeShow() {

  if ($Registration->{EditMode} == 1) {
    #Edit Mode
    $Registration->{Login}->{Visible} = 0;
  } else {
    #Add Mode
    $Registration->{Login_View}->{Visible} = 0;


<!--Registration_BeforeShow --->
  <CFIF blnEditModeRegistration>
    <CFSET hideLogin=True>
    <CFSET hideLogin_View=True>



  If (IsInsertMode) Then
    RegistrationLogin_View.Visible = False
    RegistrationLogin.Visible = False
  End if



  if (IsInsertMode) {
    RegistrationLogin_View.Visible = false;
  } else {
    RegistrationLogin.Visible = false;



  if (e.getRecord().isEditMode()) {
    //Edit Mode
  } else {
    //Add Mode

See also:

BeforeShow event, How to hide a record control

On-line, printable versions and updates