Skip to content

Select Boxes (possibly other boxes) causing line breaks and killing JS output #2

@parris

Description

@parris

Hello,
I didn't want to submit this update because it seems like a workaround and probably should simply be fixed int he cake core... In any case, if you have a form field with that will have a select box then JS will throw and unterminated string literal exception. This usually occurs if you have model_id in your appended table.

This can be fixed by replacing line 58 in node_schema_hook.php (in the helpers folder):
$jsBlock .= '$("#'.$model->alias.'SectionContent").append(''.$this->Form->input($model->alias.'.'.$k).''); ';
with:
$jsBlock .= '$("#'.$model->alias.'SectionContent").append(''.implode('\n',preg_split('/\n/',$this->Form->input($model->alias.'.'.$k))).''); ';

It does look rather disgusting, but basically I again implode the output from form input. I don't know why this issue is occurring... MEH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions