Skip to main content

I'm looking for a functionality for a Single Line Text Box for a list column that requires information. On my form I want to have a help text, a short description of the required information and the request to keep the answer under 10 words, that appears in the required field and will disappear once it is clicked on so that the user can enter the requested information.

Entering a Default value means the help text is automatically shown and the form can be submitted with this standard text instead of what the user is supposed to put in. Also this default text doesn't disappear once the field is clicked on but has to be deleted first.

The same goes for entering a Null display text.

Entering a Help text means this text will only appear as a hover text.

Who can help me out? Thanks!

Hi Yvette de Roos​,

If you configure your single line text as follows and use the script below it should work for you:

182301_pastedImage_2.png

NWF.FormFiller.Events.RegisterAfterReady(function () {

NWF$("#" + sltext).focus(function(){

if (NWF$(this).val()=="Please enter text maximum 10 characters")

{

    NWF$(this).val("");

}

});

});

Jan


to match max. 9 words use following regular expression in validation section of single line textbox settings:

/^(w+s+){0,8}w+$/

  • ^ assert position at start of the string
  • 1st Capturing group (w+s+){0,8}
    • Quantifier: {0,8} Between 0 and 8 times, as many times as possible, giving back as needed [greedy]
    • Note: A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data

    • w+ match any word character [a-zA-Z0-9_]
      • Quantifier: + Between one and unlimited times, as many times as possible, giving back as needed [greedy]

Thanks for your reply, really helpful!


Thank you Jan, for your reply!

It doesn't seem to work for me though. I can still submit the form with the null text displayed and I can also delete this text and then submit the form with a text that is over 10 characters/words long.

I've configured the control as described and I've copied and pasted the JavaScript in the form settings. It took me some time to figure this out as I'm relatively new to Nintex and not all that familiar with JavaScript... Can you explain to me what is being executed with this script?


Sure, it's registering an onfocus event for the multiline text field so that when someone clicks or tabs into it the null display text is removed. You'd need to add the validation using the regular expression as described by Manfred Lauer to do the length checking though.


Reply