Hi all,
I need your suggestions:
1. I had hidden Save,Saveas,preview and Generate buttons.Now I renamed Finish as "Save and Generate" and added a new item type dialog at the bottom of the form "SaveasDraft" button on the form.
Now If the user clicks "Save and Generate"(Finish) Button It has to go through some validations
I did OnSave---Some fields readonly..and Onsavevalid--Validatedates and autonaming of DCR From the fileName Field. as below:
function generateDCR()
{
validateDates();
if(validateDates()==true)
{
dcrName=IWDatacapture.getItem("/Article/AutogenerateName").getValue();
IWDCRInfo.setDCRName(dcrName, checkStatus);
}
}
function checkStatus() {
var status = IWDCRInfo.getStatus();
if (status == IWDCRInfo.PENDING) {
setTimeout("checkStatus()",2000); // call in 2 secs
} else if (status == IWDCRInfo.AVAILABLE || status == IWDCRInfo.UNAVAILABLE )
{
alert("entered");
IWDatacapture.save(); // save new DCR or override it anyway
} else {
// Error!! Do something here
}
}
and OnSaveDone---generatehtml function is registered and hence called.
But Now my problem is if the user clicks save as Draft I am calling generateDCR() function which does save incomplete forms.But even for the incomplete forms,Now OnSaveDone is triggered as I am calling IWDatacapture.save(); event.Now How can I block calling generate html function if the form is incomplete?and call the generate function if the form is complete?Now my Idea is:
OnsaveDone to call a function:
this does callserver and checks the attribute iw_form_valid=false;Then dont call generate html.Call only if iw_form_valid=true?Is this possible.If so how cal I get the EA attributes.Can some one please suggest.
Thanks in Advance..