How to check if fields are modified before Submitting

ursnani
Giga Guru

I have a catalog item where I am populating 10 fields based on a reference field. Now I want to make sure user has modified atleast one field.

I tried using the below code but it didnt work.

function onSubmit() {
    var field1 = g_form.getControl('frist_name');
    var field2 = g_form.getControl('department');

    	if(field1.changed || field2.changed){
        return confirm("Values on the form have changed.\nDo you really want to save this record?");
       }

I also tried using "g_form.modified" it work but that is not useful in my case as i will be entering a field value on the form.

 

Is there any way I can do it in onSubmit client script ?

 

Thanks

3 REPLIES 3

Akif_Shah
Kilo Sage
Kilo Sage

Did you try setting the field [Isolate Script] to false on the catalog client script?

Jaspal Singh
Mega Patron
Mega Patron

Above should work just ensure you have the Isolate Script set to True on the Client script form.

If you do not find the Isolate script checkbox on form you can add it on form or update it from List View.

It is set to true but still not working i ma getting error saying that "unable to find the property changed"