0

I have created an external list and in the new form I have a few input controls. Some of them are required fields but are not indicated as such on page. So I am trying to check if the input is empty and show a message that they need to fill it in. But the problem is that once the button is clicked it immediately sends the user the list. So, how can I cancel the click event if the fields are empty?

$('#ctl00_ctl40_g_9068430e_e259_454c_8cfa_f5a629496c52_ctl00_toolBarTbl_RightRptControls_ctl00_ctl00_diidIOSaveItem').click(function()
{

    var descText = $('#Description_$TextField').val();
    if(descText=='')
    {

        $('#Description_$TextField').append('<p>Please enter a description</p>');
        return false;
    }
});

1 Answer 1

0

What you are looking for is called PreSaveAction(). This function allows to override behavior for a Save button. See here for more info:

http://www.ilikesharepoint.de/2014/06/sharepoint-presaveaction-helps-for-actions-before-saving-an-item/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.