# How to use the Form Helper in javascript?

**URL:** <https://discourse.cakephp.org/t/how-to-use-the-form-helper-in-javascript/1827>\
**Category:** Need Help\
**Created:** [January 6, 2017, 9:36am UTC](https://discourse.cakephp.org/t/how-to-use-the-form-helper-in-javascript/1827 "2017-01-06T09:36:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndgAlainB](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@ndgAlainB](https://discourse.cakephp.org/u/ndgAlainB)\
**Post date:** [January 6, 2017, 9:36am UTC](https://discourse.cakephp.org/t/how-to-use-the-form-helper-in-javascript/1827/1 "2017-01-06T09:36:03Z")

</div>

Hello,

I’m wondering if it’s possible to use the FormHelper in javascript to dynamically generates HTML code.

I tried this:

```
function add_new_language(languageId, languageCodes, language) {
    $("#languageslist").append(
'\
    <?= $this->Form->input("discovery_books_languages['+ nextLanguage +'][title]", ['label' => __("Titre :"), 'id' =>'discovery_books_languages-"+ nextLanguage +"-title' , 'class' => 'form-control']); ?>\
');

```

And the generated code is:

```
<div class="form-group text">
	<label class="control-label" for="discovery_books_languages-&quot;+ nextLanguage +&quot;-title">Titre :</label>
	<input type="text" name="discovery_books_languages['+ nextLanguage +'][title]" class="form-control form-control" id="discovery_books_languages-&quot;+ nextLanguage +&quot;-title" />
</div>

```

Almost good except for the `id` which is created with html entities instead of ascii character.

Do you see a way to prevent it
