Multiline textbox get value on load

  • 1 April 2016
  • 9 replies
  • 10 views

Badge +3

I am trying to get value from a multiline text box on load of the form but that value is always blank and empty.  When I click edit item the window load runs again and the value is there that time.  Why is the value not there on the initial load?


9 replies

Userlevel 5
Badge +14

describe your requirements in more details, it's not clear what and how you are doing and you want to achieve...

I just guess you want to read content of text box from javascript but in VIEW mode it doesn't work for you whereas in EDIT it does.

Badge +7

Hi,

You may be trying to read the values before the form has fully loaded, if you wrap your script in the following function it may help.

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

//your script here

});

Jan

Badge +3

Jan Eyres, I tried that script already and I still get blank data.  The problem might be that I am retrieving the data all wrong perhaps their is a different method to get the data from Multiline textbox.  This is what I am using right now...

var txtArea = NWF$('#'+ sig2).closest('tr').find('div[id$="_inplacerte"]');

sig2 = my javascript variable of the multiline textbox

I also tried using a timeout function to wait for the form to load and form is loaded before trying to get the data and it still empty using the query.

setTimeout(function(){

},8000);

Badge +7

Hi,

Try this, var txtArea = NWF$('#'+ sig2).val();

I've tested it using a multiple lines of text (plain text) column and it works for me.

Jan

Badge +3

are you executing the code on page load?  It doesn't work there but if I connect it to button it works.  I am trying to get the value on page load.  Not sure why it doesn't work.

Badge +7

I've got this and it does work for me, but only in edit mode.

function getMultiValue()

{

var txtArea = NWF$('#'+ sig2).val();

alert(txtArea);

}

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

getMultiValue();

});

I've got it working in view mode and edit mode by creating an additional hidden field also connected to the multiline text column and configuring it as follows:

.hidden{

visibility:hidden

}

182269_pastedImage_0.png

function getMultiValue()

{

var txtArea = NWF$('#'+ sig2hidden).val();

alert(txtArea);

}

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

getMultiValue();

});

Jan

Badge +3

Jan I cant get your example to work.  I think the problem has to do with it being a dispform.aspx.  I think the field is locked down and cant get the data when it is in display mode.  When I change to new or edit the code works no problem.  It seems like when it is in display mode it has limited functionality to he point of nothing , 0.

Badge +7

Hi,

If you set the Control Mode to Edit rather than Auto on the hidden control it should work for you.

Jan

Badge +3

Jan,

Thank you so much for all of your help and suggestions.  I was getting frustrated but I am glad I finally got the problem resolved and it looks like in display mode the multi textbox is locked down to the point you can't even get data from it.  I was able to change to edit always.  My next step is to use java to hide and display as needed so that it looks clean.  Thanks again for your help took awhile to figure this out but I am happy with the results.

Reply