Proper Construct for Primefaces Dialog

后端 未结 1 1426
南笙
南笙 2020-12-06 03:15

I am getting confused on the constrcut of a Primefaces 3 dialog.

I see question in SO that has this pattern. The form is outside the dialog.



        
1条回答
  •  一个人的身影
    2020-12-06 03:29

    You always better use place the inside like this

    
              
        
    
    

    cause you dialog content might be "taken" out from your page and appended some where else in your DOM tree , so if you place the dialog inside some form, it can cause your dialog to be relocated somewhere else and to cause all your buttons/links and other elements to stop working (this is a very common question here in SO)

    So in order to be allays on the safe side place you tag inside your tag

    Another example is when you use appendToBody="true" in dialog :

    if dialog is inside an h:form component and appendToBody is enabled, on the browser dialog would be outside of form and may cause unexpected results. In this case, nest a form inside a dialog.

    0 讨论(0)
提交回复
热议问题