Answered Save and New

  • Thursday, November 01, 2007 11:06 AM
     
     
    Hi ..
    I have a problem please help me...

    I have created a form , every thing is working fine..except "Save and New"




    while updating ... when i click on "save and new" whatever changes  i have made will be saved ,BUT
    the changes or addition i make in the new form (which comes by clicking the "Save and new" button) will not be saved....

     but , while creating the form if i give "Save and new"  it works fine

    only in update i have problem....


    can anybody please help me on
    what can be done for this..... if possible with the code..


All Replies

  • Thursday, November 01, 2007 2:00 PM
    Moderator
     
     Answered

    Hi Dubak,

    Can you please explain a bit more. Can you please share the code you have written and in which event.

     

  • Friday, November 02, 2007 5:17 AM
     
     
    Thank you Umar for replying.. .


    I have added some fields on my form,i have written some OnLoad() code for Create and Update ...
    and also i have writtten some OnSave() code,
    The problem i am facing is, If i load the form make some changes and save it , it is saving the , but if select save and new instead of save or save and close , the current form will be saved and new form will be loaded if i amke any changes in that for m and click either save or save and close or save and new , changes will not be saved ...


    I will send you the customization file to ur mail..Please help me ....

    My OnLoad() code

    var CRM_FORM_TYPE_CREATE = 1;
    var CRM_FORM_TYPE_UPDATE = 2;

    switch (crmForm.FormType)
    {
    case CRM_FORM_TYPE_CREATE:
    crmForm.all.fslr_distlistid.disabled=true;
    break;

    case CRM_FORM_TYPE_UPDATE:
    {
    alert('Rreloading the form')

    if(fslr_category.DataValue ==true)
    {
    crmForm.all.fslr_fslremployee.DataValue=null;
    crmForm.all.fslr_fslremployee.disabled= true;

    }
    else
    {

    crmForm.all.fslr_distlistid.DataValue=null;
    crmForm.all.fslr_distlistid.disabled=true;

    }
    }
    break;

    }



    This is my OnSave()

    if(fslr_category.DataValue ==false)
    {
    crmForm.all.fslr_distlistid.DataValue=null;
    if(crmForm.all.fslr_fslremployee.DataValue == null)
    {
    alert('Select the Employee');
    crmForm.all.fslr_fslremployee.SetFocus();
    event.returnValue = false;
    return false;
    }
    else
    {
    crmForm.all.fslr_name.DataValue=crmForm.all.fslr_fslremployee.DataValue[0].name;
    }
    }
    else
    {
    crmForm.all.fslr_fslremployee.DataValue=null;
    if(crmForm.all.fslr_distlistid.DataValue == null)
    {
    alert('Select the Contact');
    crmForm.all.fslr_distlistid.SetFocus();
    event.returnValue = false;
    return false;
    }
    else
    {
    crmForm.all.fslr_name.DataValue=crmForm.all.fslr_distlistid.DataValue[0].name;
    }
    }