Javascript running in Display forms

rss

Posted by marcwenger - Dec 19 ’13 at 01:10

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

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 11 months
    #1 by Dmitry Kozlov Dec 22 ’13 at 10:26

    Thank you for your question. You can get text representation of fields in Display form by using the following script:

    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.

Displaying 1 to 1 of 1 messages