Reply To: How to validate HTML Input?

Forums Classic DFFS How to validate HTML Input? Reply To: How to validate HTML Input?

#33846
Harsh
Participant

Thanks for reply Alexander,

But some how i can not call this method while clicking save button,
Let me explain this again,
Please find attached image, i am using one header on form and i want title field into this header, I can not move my OOTB title field into header, i am correct?
so, i just simply create one input box in header.
In custom js i write code to hide OOTB title.


function dffs_Ready() {
$('#dffs_Title').hide();
$('#newProjectTtl').on('change', function () {
        $('#dffs_Title').find('input').val(this.value);
    });
//other codes
};

So, now when i try to save form without entring title into this field, it will not save the form, so at this time i want to validate my custom input box along with error message just like OOTB title error message.

I tried below code but it is not working, can you please help me with this?


function dffs_Ready() {
$('#dffs_Title').hide();
$('#newProjectTtl').on('change', function () {
        $('#dffs_Title').find('input').val(this.value);
    });
//other codes
};
function dffs_PreSaveAction() {
    alert("pre save call");
    var projectTitle = jQuery("#newProjectTtl").val();
    if(projectTitle === ""){
        jQuery("#newProjectTtl").css({"background-color":"#fde7e9"});
        spjs.dffs.alert({
            "title": "Missing project title",
            "msg": "Please supply the title of the project in the highlighted input field.",
            "ok": function(){
                // close dlg
            }
        });
        return false;
    }
    return true;
}

Thanks.

  • This reply was modified 2 years, 9 months ago by Harsh.
Attachments: