Monday, November 08, 2010 at 12:03 AM.

system.verbs.builtins.html.editor.formStart

on formStart (fieldName=nil, action=nil, name=nil, method="POST", enctype=nil, pta=nil) {
	<<Changes
		<<8/5/03; 6:25:29 PM by JES
			<<Added support for the Mozilla rich text editor.
		<<8/31/01; 12:37:44 PM by JES
			<<Created. Get the opening <form> tag for the HTML editor.
	
	if pta == nil {
		pta = html.getPageTableAddress ()};
	
	local (editingTool = html.editor.getEditingTool (pta));
	local (onsubmit);
	
	if editingTool beginsWith "wysiwygEditor" {
		if name == nil { //the WYSIWYG editor won't work without a name attribute
			name = "htmlEditor"};
		if fieldName == nil { //the WYSIWYG editor won't work without a field name
			fieldName = "body"};
		if string.lower (editingTool) contains "mozilla" {
			onsubmit = "submitEditForm()"}
		else { //IE
			onsubmit = "document." + name + "." + fieldName + ".value=getEditorContents()"}};
	
	local (htmltext);
	on add (s) {
		htmltext = htmltext + s};
	
	add ("<form");
	if name != nil {
		add (" name=\"" + name + "\"")};
	if method != nil {
		add (" method=\"" + method + "\"")};
	if enctype != nil {
		add (" enctype=\"" + enctype + "\"")};
	if action != nil {
		add (" action=\"" + action + "\"")};
	if onsubmit != nil {
		add (" onsubmit=\"" + onsubmit + "\"")};
	add (">");
	
	return (htmltext)}
<<bundle //testing
	<<html.editor.formStart (pta:@workspace.pt)
		<<"<form name=\"htmlEditor\" method=\"POST\" onsubmit=\"setMode(true);document.htmlEditor.body.value=document.frames('idEdit').document.body.innerHtml\">"



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.