The DevCenter has moved!

The Developer Center has a new home, developer.ektron.com. The site you are currently viewing is available as a read-only archive.
Things to note:
  1. Your username & password is the same on the new site, developer.ektron.com
  2. Going forward, please use the new URL, developer.ektron.com
  3. The old discussion forums and old KB articles are still available as an archive (read-only)
RSS Feed Print Category View
HowTo Change the Popup Dialog Box for Save
Mike Lee
Posted: Wednesday, April 18, 2007 4:30 AM
Joined: 11/7/2006
Posts: 33


Hi,

I am using Ektron and when I save the Ektron form data, it popups up a validation error dialog box with two buttons "OK" and "Cancel".

If I click on the "OK" button, it will save the Ektron form data.  How can I prevent this?

Rightfully, there should only be 1 button that will prevent the user from saving the form data if there is a validation error.  Attached is the screen shots.

Is there any way to customize the validation error pop-up dialog box?

For your kind assistance.

 

Mike


File Attachment(s):
Save_Ektron_Dialog_Box.zip (108059 bytes)

Ektron Doug D
Posted: Wednesday, April 18, 2007 8:11 AM
Joined: 6/22/2006
Posts: 1833


See section "Saving Invalid Documents" in the eWebEditPro Developer's Guide.

Set publishinvalid="false" in the editor's configuration xml data (e.g., configdataentry.xml) as shown here:

<standard ... publishinvalid="false"
Mike Lee
Posted: Wednesday, April 18, 2007 10:37 PM
Joined: 11/7/2006
Posts: 33


Hi,

Yes, I have added in the publishinvalid="false" in the configdataentry.xml but the dialog box is still showing up. I have added in this javascript :

 

<script language="JavaScript1.2">

<!--

eWebEditPro.instances["MyEditor1"].onerror = myOnErrorHandler;

function myOnErrorHandler()

{

if (EWEP_STATUS_INVALID == this.status && "save" == this.event.source)

{

var strMsg = "Content is invalid.";

strMsg += "\nError Code: " + this.event.reason;

strMsg += "\nError Reason: " + this.event.message;

alert(strMsg);

return false; // prevent save

}

}

//-->

</script>

 

But the default dialog box is showing up before my custom javascript alert message.  I found that the default validation popup dialog box is coded in ewep.js.  I have modified the ewep.js and it works as follows :

 

if (!this.validateContent()){this.event.source="save";this.status=EWEP_STATUS_INVALID;
 
 var result=this.raiseEvent("onerror");
 var bAbort=false;
 if (true==result)
 {}
 else if (false==result)
 {
   bAbort=true;}
 else{if (eWebEditProMessages.invalidContent){
  //bAbort=!confirm(this.event.message +"\n\n" + eWebEditProMessages.invalidContent);
  //Modified by Mike Lee on 19/4/2007
  alert(this.event.message + "\n" + " ");
  bAbort=true;
} }
if (bAbort){
 this.status=EWEP_STATUS_INVALID;
    bReturnValue=notifyObject(objNotify,fnNotify,false);
 return bReturnValue;} } }
 bReturnValue=false;

 

 

Is this the correct way to do this by modifying the ewep.js?

I do hope to hear from you soon.

 

Regards,

Mike


File Attachment(s):
Ektron_Validate.JPG (116678 bytes)

Ektron Doug D
Posted: Thursday, April 19, 2007 8:53 AM
Joined: 6/22/2006
Posts: 1833


To skip the validation process altogether, set publishinvalid="true", not "false" as I suggested previously. Please accept my apologies.

To validate and display a warning message, leave publishinvalid="false" and keep the JavaScript onerror handler that you have added, however, the editor name in the example, "MyEditor1", most likely is not the name you are using in your web page. Change "MyEditor1" to match the name of the editor and it should work. This JavaScript should be placed on the page with the editor after the place where editor is created.

The ewep.js file should not be changed.

 

Jump to different Forum...