Enabling/Disabling Controls at runtime

  • 18 April 2016
  • 2 replies
  • 9 views

Badge +2

Hi,

 

I've been creating a form recently where I need to make use of enabling/disabling controls based on what a user inputs in a different control. I've been using the "When control is changed" rule, however doing so seems to not update and enable/disable the control until I click off the original control, rather than when a value is entered into it.

 

So for example,

TextBox A is enabled

TextBox B is disabled

 

I type a value into TextBox A, TextBox B is still disabled. I click off TextBoxA after entering a value, TextBoxB is enabled.

 

Does anyone have any insight on how I can make the user experience more fluid here, so that TextBox B is enabled as values are entered, rather than when a different control is targeted?

 

Thanks


2 replies

Userlevel 3
Badge +8

Dear ,

 

K2 smartforms cant achieve that as i know , but u could do it by JQUERY

 

Create a datalabel in ur smartform , Make sure to have literal property checked for this data label .

Note: In my scenario , my first textbox name = a

my second textbox name = b

Add expression to this datalabel , which has the following 

 

 

<script type="text/javascript">
$('[name="a"]').keyup(function(event){
$('[name="b"]').removeClass("disabled") ;
$('[name="b"]').removeAttr("disabled");
});
</script>

 

on change on textbox named "a" , it will enable the second textbox "b"

 

Hope it helps!

Regards.

Badge +2

I'll give it a shot, thanks!

Reply