Question

I'm sorry if this is really obvious, however, I haven't found ANYTHING that explains it... using a SharePoint:FormField. I've found countless resources on how to do the following in HTML, but when I've tried to apply it to SharePoint jQuery breaks!!

So I have a SharePoint:FormField like the following

                     <tr>
                        <td width="190px" valign="top" class="ms-formlabel">
                            <H3 class="ms-standardheader">
                                <nobr>Request Type<span class="ms-formvalidation"> *</span>
                                </nobr>
                            </H3>
                        </td>
                        <td width="400px" valign="top" class="ms-formbody">
                            <SharePoint:FormField runat="server" id="ff3{$Pos}" ControlMode="New" FieldName="requestType" __designer:bind="{ddwrt:DataBind('i',concat('ff3',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@requestType')}"/>
                            <SharePoint:FieldDescription runat="server" id="ff3description{$Pos}" FieldName="requestType" ControlMode="New"/>
                        </td>
                    </tr>

And I'm just trying to get the value of SOMETHING, ANYTHING to appear in an alert, but it's giving me an undefined alert

<script type="text/javascript">
$(document).ready(function(){
    var myVar = $("SharePoint:FormField[FieldName]").val()
    alert(myVar);
    // result "undefined"
});
</script>

Please help. Many Thanks!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top