Page 1 of 1

Javascript running in Display forms

Posted: 19 Dec 2013
by marcwenger
In my new and edit forms, I have javascript to show/hide certain fields depending on another field's value. This appears not to work in the Display view, either because the script runs before the page is loaded, or the field is un-readable in the Display view. How do I get fields read in the Display form?

I put an alert(varname) in the script and when running in the display view it comes back as undefined. The same javascript works in New and Edit forms.


thanks!

-m

Re: Javascript running in Display forms

Posted: 22 Dec 2013
by Dmitry Kozlov
Thank you for your question. You can get text representation of fields in Display form by using the following script:

Code: Select all

fd.field('InternalName').control()._el().text()
But If you want to make Display form dynamic based on field values, I recommend you to use Rules:
http://spform.com/documentation/groups