Be inquisitive, be curious, be a jigyasu(an eternal learner)

Blogs

Custom control scripts for Nintex Forms

Handy scripts to get custom display value in a field based on the value submitted by the user.


To get login id of the user in a label control without @organizationname.org

  • Set the control’s CSS style value to a custom style name. (.my-custom-label in this example)
  • Include an empty style in the Custom CSS section in form settings (.my-custom-lable{}; for this example)
  • Set controls
  • NWF$(document).ready(function(){
    var ppl= NWF$(‘#’ + varEmployeeName);
    ppl.change(function(){
    if(this.value == “”){
    NWF$(“.my-custom-label label”).text(”);
    }
    else{
    var name = this.value.split(‘|’)[2].split(‘@’)[0];
    NWF$(“.my-custom-label label”).text(name);
    alert(name);
    }
    });
    });

To get custom formatted telephone(or fax) number in a label.

  • Set the control’s CSS to a custom style
  • Include empty style in the Custom CSS section in form settingsCustom CSS section in form settings (.my-custom-phone in this sample)
  • NWF$(document).ready(function() {
    var tel=NWF$(‘#’+telephoneVar);
    tel.change(function() {
    var telephone = this.value.replace(/(\d\d\d)(\d\d\d)(\d\d\d\d)/, “Tel – ($1) $2-$3”);
    NWF$(“.my-custom-phone”).text(telephone);
    alert(telephone);
    tel.prop(‘maxlength’,10); 
    });
    telephone.png
    To set maxlength of telephone/fax you can set variable.prop(‘maxlength’,10)

Note: 
Store the client id of the control in a JavaScript variable. This is what you use to get the input value from the control prior to calculating the value for display purposes.

 

 

Leave a Reply

Discover more from Woman In Tech: NAVIGATING THE DIGITAL WORLD

Subscribe now to keep reading and get access to the full archive.

Continue reading