liftshtml

lift jsonform id


I use SHtml.jsonForm in myjsonclass.show to wrap a jsonform to the HTML page with the following command:

<div id="form" class="lift:myjsonclass.show">

It works fine.

The SHtml.jsonForm method defines a random id for the form tag, I wonder if there is a solution to get that id and use it in the HTML. It will make easier for example to apply form validators in Javascript.


Solution

  • I have solved that by accessing a known element of the form and asking for its parent in javascript: element.parent(); So I am able to get id of the form with: element.attr('id').