View Source PhoenixFormAwesomplete.GenJS (PhoenixFormAwesomplete v0.3.1)

Generate the javascript code for PhoenixFormAwesomplete.

Example

iex> PhoenixFormAwesomplete.GenJS.awesomplete_js("user_drinks", %{ minChars: 1, prepop: true } )
"AwesompleteUtil.start('#user_drinks', {prepop: true}, {minChars: 1});"

Summary

Functions

This method generates javascript code for using Awesomplete(Util).

Create javascript that listens to awesomplete-prepop and awesomplete-match events, and copies the data_field to the DOM element with the given target id. The target_id can also be a javascript function.

Functions

Link to this function

awesomplete_js(element_id, awesomplete_opts)

View Source

This method generates javascript code for using Awesomplete(Util).

Example

iex> PhoenixFormAwesomplete.GenJS.awesomplete_js("user_hobby", %{ minChars: 1 } ) 
"AwesompleteUtil.start('#user_hobby', {}, {minChars: 1});"
Link to this function

copy_to_id_js(source_id, data_field \\ nil, target_id)

View Source

Create javascript that listens to awesomplete-prepop and awesomplete-match events, and copies the data_field to the DOM element with the given target id. The target_id can also be a javascript function.

Example

iex> PhoenixFormAwesomplete.GenJS.copy_to_id_js("#user_color", "label", "#awe-color-result") 
"AwesompleteUtil.startCopy('#user_color', 'label', '#awe-color-result');"