Hi all ,
I have a requirement that i need to add custom attribute in input element. I have added in corresponding input element html file in /editor/dialog/xxx.html files and fck_dialog_common.js file . It works fine and give the exact html one i expected " <input validator="ipAddress" ismandatory="yes" maxlength="15" size="15" value="" name="sampleIP" type="text"> ". But if i right click and select property which dosn't show the property what i have selected like IpAddress, ismandatory value for the attributs validator and ismandatory respectively.
Following are the html code in textfiled.html file
<tr>
<td>
<span fcklang="DlgTextType">Type</span><br />
<select id="txtType">
<option value="text" selected="selected" fcklang="DlgTextTypeText">Text</option>
<option value="password" fcklang="DlgTextTypePass">Password</option>
</select>
</td>
<td>
</td>
<td>
<span>isMandatory</span><br />
<select id="txtMandatory">
<option value="no" selected="selected" >No</option>
<option value="yes" >Yes</option>
</select>
</td>
</tr>
<tr>
<td>
<span>Validator</span><br />
<select id="txtValidator">
<option value="" selected="selected"></option>
<option value="ipAddress">IPAddress</option>
<option value="mail" >Email</option>
<option value="numeric" >Numeric</option>
<option value="alphanumeric" >Alpha Numeric</option>
</select>
</td>
<td>
</td>
<td>
</td>
</tr>
and function ok is as follows
function Ok()
{
txtfieldname = trimString(GetE('txtName').value);
if(txtfieldname == ''){
alert( "Name should not be empty." );
GetE('txtName').focus() ;
return false ;
}else if (checkWhiteSpace(txtfieldname) == "true")
{
alert( "Name should not have white space." );
GetE('txtName').focus() ;
return false ;
}else if ( isNaN( GetE('txtMax').value ) || GetE('txtMax').value < 0 )
{
alert( "Maximum characters must be a positive number." ) ;
GetE('txtMax').focus() ;
return false ;
}
else if( isNaN( GetE('txtSize').value ) || GetE('txtSize').value < 0 )
{
alert( "Width must be a positive number." ) ;
GetE('txtSize').focus() ;
return false ;
}
oEditor.FCKUndo.SaveUndoStep() ;
oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'INPUT', {name: GetE('txtName').value, type: GetE('txtType').value } ) ;
SetAttribute( oActiveEl, 'value' , GetE('txtValue').value ) ;
SetAttribute( oActiveEl, 'size' , GetE('txtSize').value ) ;
SetAttribute( oActiveEl, 'maxlength', GetE('txtMax').value ) ;
SetAttribute( oActiveEl, 'isMandatory', GetE('txtMandatory').value ) ;
if(GetE('txtValidator').value!=''){
SetAttribute( oActiveEl, 'validator', GetE('txtValidator').value ) ;
}
return true ;
}
Please help me to resolve this issues."While select the property of the element it has to show the property one i already provided".
Thanks
Mgdhayal.
I have a requirement that i need to add custom attribute in input element. I have added in corresponding input element html file in /editor/dialog/xxx.html files and fck_dialog_common.js file . It works fine and give the exact html one i expected " <input validator="ipAddress" ismandatory="yes" maxlength="15" size="15" value="" name="sampleIP" type="text"> ". But if i right click and select property which dosn't show the property what i have selected like IpAddress, ismandatory value for the attributs validator and ismandatory respectively.
Following are the html code in textfiled.html file
<tr>
<td>
<span fcklang="DlgTextType">Type</span><br />
<select id="txtType">
<option value="text" selected="selected" fcklang="DlgTextTypeText">Text</option>
<option value="password" fcklang="DlgTextTypePass">Password</option>
</select>
</td>
<td>
</td>
<td>
<span>isMandatory</span><br />
<select id="txtMandatory">
<option value="no" selected="selected" >No</option>
<option value="yes" >Yes</option>
</select>
</td>
</tr>
<tr>
<td>
<span>Validator</span><br />
<select id="txtValidator">
<option value="" selected="selected"></option>
<option value="ipAddress">IPAddress</option>
<option value="mail" >Email</option>
<option value="numeric" >Numeric</option>
<option value="alphanumeric" >Alpha Numeric</option>
</select>
</td>
<td>
</td>
<td>
</td>
</tr>
and function ok is as follows
function Ok()
{
txtfieldname = trimString(GetE('txtName').value);
if(txtfieldname == ''){
alert( "Name should not be empty." );
GetE('txtName').focus() ;
return false ;
}else if (checkWhiteSpace(txtfieldname) == "true")
{
alert( "Name should not have white space." );
GetE('txtName').focus() ;
return false ;
}else if ( isNaN( GetE('txtMax').value ) || GetE('txtMax').value < 0 )
{
alert( "Maximum characters must be a positive number." ) ;
GetE('txtMax').focus() ;
return false ;
}
else if( isNaN( GetE('txtSize').value ) || GetE('txtSize').value < 0 )
{
alert( "Width must be a positive number." ) ;
GetE('txtSize').focus() ;
return false ;
}
oEditor.FCKUndo.SaveUndoStep() ;
oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'INPUT', {name: GetE('txtName').value, type: GetE('txtType').value } ) ;
SetAttribute( oActiveEl, 'value' , GetE('txtValue').value ) ;
SetAttribute( oActiveEl, 'size' , GetE('txtSize').value ) ;
SetAttribute( oActiveEl, 'maxlength', GetE('txtMax').value ) ;
SetAttribute( oActiveEl, 'isMandatory', GetE('txtMandatory').value ) ;
if(GetE('txtValidator').value!=''){
SetAttribute( oActiveEl, 'validator', GetE('txtValidator').value ) ;
}
return true ;
}
Please help me to resolve this issues."While select the property of the element it has to show the property one i already provided".
Thanks
Mgdhayal.