Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

[urgent] sharepoint custom list form attachment client side validation Jquery

$
0
0

i have custom list form and i have OOTB attachment field but when i click submit button ,uploaded attachments not getting updated in list items

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
 $('nobr:contains("status")').closest('tr').hide();
});
function createListItem() {
        var clientContext = new SP.ClientContext.get_current();
        var oList = clientContext.get_web().get_lists().getByTitle('Test');

        var itemCreateInfo = new SP.ListItemCreationInformation();
        this.oListItem = oList.addItem(itemCreateInfo);
        oListItem.set_item('Title', $("input[title='Title Required Field']").val());
oListItem.set_item('Attachments',$("input[title='Attachments']").val());
        oListItem.set_item('status', 'submit');
        oListItem.update();

        clientContext.load(oListItem);
        clientContext.executeQueryAsync(
            Function.createDelegate(this, this.onQuerySucceeded), 
            Function.createDelegate(this, this.onQueryFailed)
        );
    }

    function onQuerySucceeded() {
        window.location.href="";
    }

    function onQueryFailed(sender, args) {
        alert('Request failed. ' + args.get_message() + 
            '\n' + args.get_stackTrace());
    }
</script>
<input type="button" value="submit" onclick="createListItem()"/>


Blitz


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>