[KULRICE-9074] Dialog response inputs can stomp on each other Created: 04/Mar/13  Updated: 12/Aug/13  Resolved: 28/Mar/13

Status: Closed
Project: Kuali Rice Development
Component/s: Development
Affects Version/s: None
Fix Version/s: 2.3.0-m1, 2.3
Security Level: Public (Public: Anyone can view)

Type: Bug Fix Priority: Major
Reporter: Jerry Neal (Inactive) Assignee: Shannon Hess
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
cloned from KULRICE-7208 Template Closed
Relate
is related to KULRICE-9018 Dialog in maintenance document doesn... Closed
Rice Module:
KRAD
KAI Review Status: Not Required
KTI Review Status: Not Required
Include in Release Notes?:
Yes

 Description   

Dialog group uses form properties dialogResponse and dialogExplanation to generically store dialog input. When multiple dialogs are present on the same page they stomp on each other (since all dialogs point to the same property). These need to be changed to use maps where the key is the dialog group id



 Comments   
Comment by Shannon Hess [ 27/Mar/13 ]

I'm having issues with the implementation of this. I believe my property name is incorrect, but need some advice about what it should be. I have a meeting tomorrow with Jerry to discuss the issue.

Currently the way I have it set up it is working for the first call to the "predefined ok/cancel" dialog box and the correct answer is displayed in the text box (On the Dialog Test View). After the first call, the following error appears in the logs and the dialog box no longer appears when hitting the "predefined ok/cancel" button.

Error:

2013-03-27 00:43:23,620 [http-apr-8080-exec-9] u:admin/d: ERROR freemarker.runtime - Template processing error: "Method public org.springframework.web.servlet.support.BindStatus org.springframework.web.servlet.support.RequestContext.getBindStatus(java.lang.String) throws java.lang.IllegalStateException threw an exception when invoked on org.springframework.web.servlet.support.RequestContext@311eadbf with arguments of types [java.lang.String,]"

Method public org.springframework.web.servlet.support.BindStatus org.springframework.web.servlet.support.RequestContext.getBindStatus(java.lang.String) throws java.lang.IllegalStateException threw an exception when invoked on org.springframework.web.servlet.support.RequestContext@311eadbf with arguments of types [java.lang.String,]
The problematic instruction:
----------
==> assignment: status=springMacroRequestContext.getBindStatus(path) [on line 136, column 9 in krad/WEB-INF/ftl/lib/spring.ftl]
 in user-directive bind [on line 291, column 5 in krad/WEB-INF/ftl/lib/spring.ftl]
 in user-directive spring.formRadioButtons [on line 38, column 9 in krad/WEB-INF/ftl/com
...
...
...
Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'null' of bean class [edu.sampleu.demo.kitchensink.UifDialogTestForm]: Bean property 'null' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:729)
	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:721)
	at org.kuali.rice.krad.web.bind.UifViewBeanWrapper.getPropertyValue(UifViewBeanWrapper.java:203)
	at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:99)
	at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:226)
	at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
	at org.springframework.web.servlet.support.RequestContext.getBindStatus(RequestContext.java:722)
	at sun.reflect.GeneratedMethodAccessor611.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:866)
	at freemarker.ext.beans.OverloadedMethodModel.exec(OverloadedMethodModel.java:104)

Bean -

<bean id="Uif-DialogResponse" parent="Uif-InputField" p:propertyName="dialogResponse[@{#parent.id}]"
        p:bindingInfo.bindToForm="true">
    ...
    ...
    ...
    <property name="onChangeScript" value="lightboxButtonScript();"/>
</bean>
Comment by Shannon Hess [ 28/Mar/13 ]

I talked to Jerry about this, and after some discussion it turns out that this isn't an issue after all. dialogResponse and dialogExplanation are on the form, but there is also a DialogManager, which holds the answer and explanation for each dialog.

I'm going to go ahead and close this issue.

Change made locally to doSomething in DialogTestViewUifController to test this theory:

    @RequestMapping(params = "methodToCall=" + "doRadioDialogExample")
    public ModelAndView doSomething(@ModelAttribute("KualiForm") UifDialogTestForm form, BindingResult result,
            HttpServletRequest request, HttpServletResponse response) throws Exception {
        String dialog1 = "sampleRadioButtonDialog";
        String dialog2 = "preDefinedDialogOkCancel";

        if (!hasDialogBeenAnswered(dialog1, form)){
            // redirect back to client to display lightbox
            return showDialog(dialog1, form, request, response);
        }

        if (!hasDialogBeenAnswered(dialog2, form)){
            // redirect back to client to display lightbox
            return showDialog(dialog2, form, request, response);
        }
        // Get value from chosen radio button
        String choice = form.getDialogManager().getDialogExplanation(dialog1);
        String choiceDialog2 = form.getDialogManager().getDialogAnswer(dialog2);

        if (choice == null){
            form.setField1("You didn't select one of the radio buttons");
        } else {
            form.setField1("You chose Radio Option "+choice + choiceDialog2);
        }

        // clear dialog history so they can press the button again
        form.getDialogManager().removeDialog(dialog1);
        // reload page1
        return getUIFModelAndView(form, "DialogView-Page1");
    }
Generated at Wed Mar 03 06:00:23 CST 2021 using JIRA 7.0.11#70121-sha1:19d24976997c1d95f06f3e327e087be0b71f28d4.