#2180: Display simple textarea if javascript is disabled
-------------------------+--------------------------------------------------
Reporter: wwalc | Owner:
Type: New Feature | Status: new
Priority: Normal | Milestone:
Component: General | Version:
Keywords: Confirmed |
-------------------------+--------------------------------------------------
If javascript is disabled in FCKeditor compatible browser, most of the
time nothing appears to the end user (neither FCKeditor nor simple
textarea).
The only example that works with javascript disabled is sample02.html.
I belive that many people use server side integration and are unaware of
this problem. Below is a simple work-around for this issue:
{{{
public function CreateHtml()
{
$HtmlValue = htmlspecialchars( $this->Value ) ;
$Html = '' ;
if ( strpos( $this->Width, '%' ) === false )
$WidthCSS = $this->Width . 'px' ;
else
$WidthCSS = $this->Width ;
if ( strpos( $this->Height, '%' ) === false )
$HeightCSS = $this->Height . 'px' ;
else
$HeightCSS = $this->Height ;
if ( $this->IsCompatible() )
{
if ( isset( $_GET['fcksource'] ) && $_GET['fcksource'] ==
"true" )
$File = 'fckeditor.original.html' ;
else
$File = 'fckeditor.html' ;
$Link =
"{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ;
if ( $this->ToolbarSet != '' )
$Link .= "&Toolbar={$this->ToolbarSet}" ;
// Render the linked hidden field.
$Html .= "<input type=\"hidden\"
id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\"
value=\"{$HtmlValue}\" style=\"display:none\" />" ;
// Render the configurations hidden field.
$Html .= "<input type=\"hidden\"
id=\"{$this->InstanceName}___Config\" value=\"" .
$this->GetConfigFieldString() . "\" style=\"display:none\" />" ;
// Render the editor IFRAME.
$Html .= "<iframe style=\"display:none\"
id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\"
width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\"
scrolling=\"no\"></iframe>" ;
// If JavaScript is enabled, make iframe above visible
$Html .= "<script type=\"text/javascript\">" ;
$Html .= "<!--\n";
$Html .=
"document.getElementById('{$this->InstanceName}___Frame').style.display='';";
$Html .= "\n//-->";
$Html .= "</script>" ;
//If JavaScript is disabled, display simple textarea and
leave iframe invisible
$Html .= "<noscript>";
$Html .= "<textarea name=\"{$this->InstanceName}\"
rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height:
{$HeightCSS}\">{$HtmlValue}</textarea>" ;
$Html .= "</noscript>" ;
}
else
{
$Html .= "<textarea name=\"{$this->InstanceName}\"
rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height:
{$HeightCSS}\">{$HtmlValue}</textarea>" ;
}
return $Html ;
}
}}}
I know it's ugly but it seems to work. The problem is that the same value
($HtmlValue) is posted twice for textarea and hidden field. I'm not sure
whether there is a way to copy this value from textarea in `<noscript>`
tag to a hidden field.
Do you have any other proposals?
--
Ticket URL: <http://dev.fckeditor.net/ticket/2180>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac