CodeCharge Studio | All ASP PHP Perl ColdFusion Java C#.NET VB.NET |
This example demonstrates how to dynamically set value of a component attribute, in this case disabling textbox when users view their profile.
Let's assume that we have a TextBox named user_login, located in Registration form. The event code disables the textbox if the URL contains mode=profile.
<input name="{user_login_Name}" value="{user_login}" {user_login:disabled}>
If CCGetFromGet("mode", "") = "profile" Then _ Sender.Attributes("disabled") = "disabled"
if (CCGetParam('mode', '') == 'profile') { $Component->Attributes->SetValue('disabled', 'disabled'); }
if (CCGetFromGet('mode', '') eq 'profile') { $Component->{Attributes}->SetValue('disabled', 'disabled'); }
<CFPARAM Name="URL.mode" Default=""> <CFIF URL.mode EQ "profile"> <CFSET StructInsert(attrUser_login, "disabled", "disabled", True)> </CFIF>
If Request.QueryString("mode") = "profile" Then ControlAttributes.Add(usersuser_login, New CCSControlAttribute("disabled", FieldType._Text, "true")) End If
if (Request.QueryString["mode"] == "profile") { ControlAttributes.Add(usersuser_login, new CCSControlAttribute("disabled", FieldType.Text, "true")); }
if ("profile".equals(e.getPage().getHttpGetParams().getParameter("mode"))) { ((com.codecharge.util.ModelAttribute)e.getModel().getAttribute("disabled")).setValue("disabled"); }