Personal tools

Log in

Changes

From All n One's bxp software Wixi

Jump to: navigation, search

JavaScript - Detecting if a question is visible

1,985 bytes added, 15:25, 1 September 2014
Created page with "It is possible in Business Express (BeX), to show and hide questions. When performing validation it can be useful to tell if the question is currently displayed or not. A q..."
It is possible in bxp software (bxp), to show and hide questions. When performing validation it can be useful to tell if the question is currently displayed or not.


A question in bxp is surround by a table and it is this table you need to check for. Taking a sample of a simple question.

<syntaxhighlight lang="html4strict">

<table class="cssMaster_Table100PC" width="100%" id="tableid_1">
<tr id="tableid_1_tr" valign="top">
<td id="tableid_1_testing_3" width="0%" height="30" ></td>
<td id="tableid_1_testing_4" width="48%" height="30"><div class="Spoken">Contract Name</div></td>
<td id="tableid_1_testing_5" width="5%" height="30"></td>
<td id="tableid_1_testing_6" width="45%" height="30"><input type="text" name="strCDA_154_field_0_1" id="strCDA_154_field_0_1" value="" class="Notes" style="width:98%;" tabindex="10" onfocus="fn_Focus(this.id);" onchange="fn_Focus(this.id);" onclick="fn_Focus(this.id);" /></td>
<td id="tableid_1_testing_7" style="width:11px;" height="30">&nbsp;&nbsp;&nbsp;<a href="../campaign/userCDD_Edit-details.asp?intCampaign_Id=154&amp;ID=2&amp;intCDA_Id=0&amp;strInline=true&amp;strType=Inbound"><img src="https://ww3.allnone.ie/images/main/edit_this.png" border="0" height="12" width="12" name="btn_Edit_tableid_1" id="btn_Edit_tableid_1" title="Edit this item" alt="Edit this item" /></a>&nbsp;</td>
<td id="tableid_1_testing_8" style="width:11px;" height="30">&nbsp;</td>
</tr>
<tr id="tableid_1_tr2">
<td colspan="6"><br/></td>
</tr>

</table>

</syntaxhighlight>


The question is strCDA_154_field_0_1 but it is contained within tableid_1.


If this question is hidden, it will be tableid_1 we need to check.


<syntaxhighlight lang="javascript">

if (document.getElementById('tableid_1').style.display == 'none'){

}
else if (document.getElementById('tableid_1').style.display == 'inline-table'){

}

</syntaxhighlight>


This functionality is very useful in validation, i.e. only validate if logic is currently showing it.
7,528
edits