PrepAway - Latest Free Exam Questions & Answers

Which code segment should you add at line 03?

You create a custom page layout that contains the following code segment. (Line numbers are included for reference only.)

01 Please enter a number:
02 <SharePointWebControls:InputFormTextBox ID=”NumberTextBox” runat=”server”/>
03

You need to prevent the page from being saved if NumberTextBox is empty.

Which code segment should you add at line 03?

PrepAway - Latest Free Exam Questions & Answers

A.
<script type=”javascript”>if(document.getElementById(‘NumberTextBox’).value = ”) return false;</script>

B.
<script type=”javascript”>if(document.getElementById(‘NumberTextBox’).value = ”) return true;</script>

C.
<SharePointWebControls:InputFormCompareValidator ID=”NumberValidator” runat=”server” ControlToValidate=”NumberTextBox”/>

D.
<SharePointWebControls:InputFormRequiredFieldValidator ID=”NumberValidator” runat=”server” ControlToValidate=”NumberTextBox”/>

Explanation:
MNEMONIC RULE: “InputFormRequiredFieldValidator”

RequiredFieldValidator makes sure you provide a value for the field before the form can be submitted.


Leave a Reply