Forum OpenACS Development: ad_form submit

Collapse
Posted by Iuri Sampaio on
Hi there,

I've noticed that when the switch "-has_submit 1" is used within ad_form proc, the block html onchange does not execute.

Example:

if a custom submit button is declared, as in:

ad_form -name item -has_submit 1 -form {
...
{content_type:text(select) {label ""}
{options {{"[_ evex-item.Select_type]" ""} {"[_ evex-item.Venue]" ee_venue} {"[_ evex-item.Service]" ee_service}}}
{html {onChange "document.item.__refreshing_p.value='1';document.item.submit()"}}
{mode display}
}
...


{submit:text(submit) {label {[_ evex-item.Save]}} {value 1}}
}

JS chunk document.item.__refreshing_p.value='1';document.item.submit()"
becomes useless.

However, when the switch has_submit and its custom submit button are removed, JS chunk gets back working just fine.

{html {onChange "document.item.__refreshing_p.value='1';document.item.submit()"}}

As I'm not familiar with acs-templating yet, I'm lost where I must start to look or amend.

Any ideas?

Best wishes

Collapse
2: Re: ad_form submit (response to 1)
Posted by Iuri Sampaio on
Hi there,

Backend's implementation for ad_form is within packages/acs-templating/tcl/form-procs.tcl. Plus, frontend templates can be found within packages/acs-templating/resources/forms/

The issue was related to how submit button has been named.

If the switch -has_submit is in place, then to re-use acs-templating resources, the submit button must have its name assigned as "ok", such as:
...
{ok:text(submit) {label {[_ evex-item.Save]} {value 1}}}

Otherwise, the code available in acs-templating pkg won't be aware of it, then customized chunks of TCL and Javascript get in the scenario.

Best wishes,