Add new record from subform can not work

I create master detail form (master and detail id list)
 
I cannot add new record from subform
 
here my code: 
        <Element Name="btn_new" Class="Button" Text="Neww" CssClass="button">
            <EventHandler Name="onclick" Event="onclick"
                Function="NewRecord()"
                FunctionType="Prop_Dialog"
                RedirectPage="form=mymodule.form.HistoryNewForm"/>
        </Element>

when i click New button, error happened : "Json error: SyntaxError: Badly formed JSON string:..." ) 
 
i change FunctionType="Prop_Dialog" to FunctionType="Openbiz.Window.openDialog", also can not work
 
if i remove FunctionType="Prop_Dialog" or FunctionType="Openbiz.Window.openDialog",
HistoryNewForm can work but, "Foreign Key" not fill automaticaly
 
for temporary i add parameter (manualy)
 
Function="NewRecord()"
RedirectPage="form=mymodule.form.HistoryNewForm&amp;fld:parent_id={@mymodule.do.ParentDO:Field[Id].Value}"


but this method can not work on first record if page refreshed
this method only work if user click row (except fist row) on master list
 
if user not click row on master list,
cursor of ParentDO is in last record,
but cursor in master form is in first row
 

 

You can use

You can use Function="loadDialog($formName, $id=null)". This should allow you to load a form in Dialog popup.

- support