Forum OpenACS Development: Re: ad_form refreshing

Collapse
4: Re: ad_form refreshing (response to 3)
Posted by Iuri Sampaio on
here it is the piece of code i am talking about.

as you said it is very basic and i see no error on it that could possibly be blocking the "refreshing effect"

ad_form -name cal_item -export { return_url } -form {
{calendar_id:integer(select)
{label "[_ calendar.Sharing]"}
{options $calendar_options}
{html {onChange "document.lineaddedit.__refreshing_p.value='1';document.lineaddedit.submit()"}}
}

#set cal_item_types [calendar::get_item_types -calendar_id $calendar_id]
#if {[llength $cal_item_types] > 1} { }

{item_type_id:integer(select),optional
{label "[_ calendar.Type_1]"}
{options { {"Choose" ""} [calendar::get_item_types -calendar_id $calendar_id] } }
{help_text "[_ calendar.Type_Help]"}
}
... (rest of the form) ...

}

Collapse
5: Re: ad_form refreshing (response to 4)
Posted by Claudio Pasolini on
The line:

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

shoid read:

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

Remember to add calendar_id to the parameters of ad_page_contract.

Collapse
6: Re: ad_form refreshing (response to 5)
Posted by Iuri Sampaio on
good! i was paying atention to ad_form -name

I fixed and now i get the refreshing behavior working well. Although the values is still not properly set.

It gets stuck on the last values of the list of ids and no matter we change the parent field the id never changes

yes, i did put $cal_id in ad_page_contract parameters.

I put $cal_id also as label of the field just to see what was into the var $cal_id,


{cal_id:integer(select)
{label "[_ calendar.Sharing]"}
{options { {"Select" ""} $calendar_options} }
{html {onChange "document.cal_item.__refreshing_p.value='1';document.cal_item.submit()"}}
}

#set cal_item_types [calendar::get_item_types -calendar_id $calendar_id]
#if {[llength $cal_item_types] > 1} { }

{item_type_id:integer(select),optional
{label "$cal_id [_ calendar.Type_1]"}
{options { {"Choose" ""} [calendar::get_item_types -calendar_id $cal_id] } }
{help_text "[_ calendar.Type_Help]"}

Collapse
7: Re: ad_form refreshing (response to 6)
Posted by Iuri Sampaio on
Nevermind,

I had $cal_id being used in another part of the code and that was causing conflict. it was overwriting the ad_form values.

thanks, it works fine now! ad_form is just wonderful ;)

Collapse
8: Re: ad_form refreshing (response to 7)
Posted by Iuri Sampaio on
When the form get refreshed it misses some vars. Those vars can not be missed, otherwise actions get switched.

how does I refresh the form passing the vars needed?