Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

TextField - Read failing in custom objects using getFieldValue() function.

SanjayAgarwal
Contributor III

Hi,

We are trying to read the value of text field ( In field options it is text field and not text area) using custom objects like $CM.getFieldValue() by passing correct arguments. But it fails with error that textField.get_value() is not defined function.

As a wordaround I am using $("#textFieldID").html() to get the value but is there more generic way to read it in javascript? 

12 REPLIES 12

Hi David,

Could you give a specific example of how to implement this?

"Yes, that function only works in edit mode.  You'll have to use $("#textFieldID") for view mode."

I get "undefined" when I try to access a text field in view mode using this ...

 

@LesIsaacson, easiest way to find out the id is to right-click over the text of the field and select inspect 

Ideally you'd do something like this.

 

$('span[id$="f1569c"]').val();

Replace 1569 with the actual field ID of the text area field and remember that HTML formatting will most likely be returned.

Going forward you should be using variable for any field IDs and better yet use, The Horror's of Moving Custom Objects from One Environment to Another - RSA Link - 569029 so that you don't have to touch the custom object when moving the application from one environment to another.

 

 Advisory Consultant

Thanks David, this was very helpful.