Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try</p> <pre><code>if (section != null &amp;&amp; section !="")... </code></pre> <p>You may find that a field which is initially blank is null, whereas one from which you have deleted content but not yet saved the form is simply an empty string. Certainly worth a shot.</p> <pre><code>show==true </code></pre> <p>is incorrect as others have pointed out (needs to be show=true) but is simply redundant as written inside the same IF statement, just replace next line as:</p> <pre><code>tab.setVisible(true); </code></pre> <p>It is possible you intended "show" to be the default tab state to use if text field is not empty, in which case just move this line outside the IF instead of changing it (as shown below)</p> <p>It looks like the construction using the third "show" parameter is to allow you to use the function to set the tab state to a specific state of shown or not without looking for a text field value at all. You would need to pass parameters as eg tabname,,true - you might consider swapping the TextFieldName and Show parameters so it is easier to just drop the third rather than remember to double-comma.</p> <p>While we're fixing stuff, lets replace that variable "section" with something with a more meaningful name:</p> <pre><code>function setVisibleTabSection(tabname, show, TextFieldName) //usage: show is state Tab will have if no TextFieldName is specified, or if text field is empty { var tab = Xrm.Page.ui.tabs.get(tabname); if (tab != null) { if (show==null){show=true;} if (TextFieldName == null) { tab.setVisible(show); } else { var strFieldValue = Xrm.Page.data.entity.attributes.get(TextFieldName).getValue(); if (strFieldValue != null &amp;&amp; strFieldValue !="") {show=true;} tab.setVisible(show); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload