This topic is locked
[SOLVED]

 Text Area and Placeholder Dimensions

1/9/2019 12:00:33 PM
ASPRunner.NET General questions
D
DCherrington author

I have been using ASPrunner.NET to create a series of input forms so that users can input data directly into my database. I am having an issue with a particular form that is used for users to write some narrative, which will go into my database as text (obviously) and be outputted into a text placeholder. Due to the nature of the final report, users need to limit the amount of text they write.
I use Text Area as the Edit As option, mainly as this wraps text and allows users to review what they have written easily. However, as I can't set a character limit on a text area, I set the placeholder size to specific dimensions to give the users an idea of what will fit into the final report. For example, my first field is on top (Narrative) and has a placeholder of 600px by 110px, and my second field is underneath (Actions) and has a placeholder of 480px by 380px.
In version 9.8 I am able to do this using a mixture of freeform mode and html, but I'm currently in the process of rebuilding the report up from scratch in version 10 and don't seem to able to recreate this functionality. Any tips to help me?

jadachDevClub member 1/9/2019

In this case, my text area field in the database is called Description. I want to set a max length allowed to 200.
For the add and edit pages, add the following to JavaScript OnLoad events. Change the field name to match yours.

var ctrlDescription = Runner.getControl(pageid,'Description');
ctrlDescription.on('keyup',function(e, argsArr){

var len = this.getValue().length;

if (len > 200)

{

alert("Maximum length allowed: 200.");

this.setValue(this.getValue().substring(0, 200));

}

});
D
DCherrington author 1/10/2019



In this case, my text area field in the database is called Description. I want to set a max length allowed to 200.
For the add and edit pages, add the following to JavaScript OnLoad events. Change the field name to match yours.

var ctrlDescription = Runner.getControl(pageid,'Description');
ctrlDescription.on('keyup',function(e, argsArr){

var len = this.getValue().length;

if (len > 200)

{

alert("Maximum length allowed: 200.");

this.setValue(this.getValue().substring(0, 200));

}

});



Great, thanks Jerry. Not exactly what I was going for, but it is actually what the requirement was when I originally started the project.
I can make this work. Thanks very much!