.... 
  placeholder body { displayNote() "important note" }
}
define ajax displayNote(){
  form{
     ...
  }
}

This example has the downside that when form validation triggers, the entire page is re-rendered, since the ajax template is used as regular template.

If the example is only supposed to replace the placeholder when re-rendered (a typical case), this can only be achieved using a workaround that uses an additional request to load the ajax template:

        ....
        placeholder body{} fix()
      }  
      define fix(){
    var tid := getUniqueTemplateId()
    form{ submitlink action{replace(body,displayNote());}[id=""+tid, style="display:none;"]{} }
    <script>
      $("#~tid").click();
    </script>
      }

To support this common situation better we can add a placeholder variant that only takes an ajax template call and renders it as ajax (form validation will only re-render the placeholder):

placeholder body displayNote()
Submitted by Danny Groenewegen on 28 January 2011 at 14:11

On 5 February 2011 at 22:08 Danny Groenewegen tagged 1.2.7

On 5 February 2011 at 22:08 Danny Groenewegen closed this issue.

Log in to post comments