1

Topic: Removing 'name' from 'form' element

Hi,

after htmLawed of html it's removing the name attribute of form element.

reply me solution

2

Re: Removing 'name' from 'form' element

The 'name' attribute of 'form' is a deprecated one. By default, htmLawed will replace it with 'id' if an' id' attribute doesn't pre-exist and if the 'name' value is appropriate for 'id'. To prevent this, which means other deprecated attributes will be let in, you have to configure htmLawed to allow deprecated attributes by setting 'no_deprecated_attr' to 0:

$config = array(..., 'no_deprecated_attr'=>0, ...);
$out = htmLawed($in, $config);

To disallow deprecated attributes but allow 'name' in 'form', you'll have to edit the code; in line ~445 of htmLawed.php, remove 'form' from the 'name' array within the '$aND' array:

static $aND = array(...ipt'=>1), 'name'=>array('a'=>1, 'form'=>1, 'ifra...);

With the code edited, htmLawed doesn't have to be configured with  'no_deprecated_attr' -- by default it will remove/change deprecated attributes except for 'form'/'name'.