“Object doesn't support this property or method”

385 Views Asked by At

I have searched google for a long time before asking this question, but no luck.

I am trying to open a pop up using jquery, but I am unable to do it. I have included jquery-v.v.v.js and jquery-ui.custom.js in my jsp as follows.

    <script language="javascript" type="text/javascript"
            src="../js/common/jquery-1.9.1.js"></script>
    <script language="javascript" type="text/javascript"
             src="../js/common/jquery-ui.custom.js"></script>

And in the jsp file I have form. Upon submitting the form, it calls a service(from struts 1.x action class) and returns some data which I have to show in the pop up. This is the code I am using to do this work.

    function ValidateAddresspopup(){
      var url ='<%= request.getContextPath()%>'+"/uspsValidation.do";
      $.post(url, {homeaddress2:document.forms[0].streetCurr.value,homecity:document.forms[0].cityCurr.value, homezip5:document.forms[0].currZip5.value, homestate:document.forms[0].statecurr.value,mailaddress2:document.forms[0].streetChange.value,mailcity:document.forms[0].cityChange.value,mailzip5:document.forms[0].zip5Change.value,mailstate:document.forms[0].statechange.value,medicaidid:document.forms[0].medicaidid.value}, function(data) {

              alert("data"+data.trim());

             registerModalDialog("msAddrModal");
             openViewDialog("msAddrModal");

             //some code to split the data received and set in the popup fields. });

I have returned the data from the action class as a string and I can see the data in the alert. The registerModalDialog() and openViewDialog() functions are as follows.

    function registerModalDialog(dialogId){
      $('#'+dialogId).dialog({
      autoOpen : false,
      modal : true,
      dialogClass : 'web_dialog',
      width : 'auto',
      height : 'auto',
      draggable : false
}).parent().draggable();}

    function openViewDialog(divId)
    {
     $('#'+divId).dialog("open");
     $(".ui-dialog-titlebar").hide();
     $(".ui-dialog-content").css("padding", 0);
     $(".ui-dialog").css("overflow", "hidden"); }

The argument passed to both the functions is the id of the div I want to show in the pop up. Now I am getting the error "“Object doesn't support this property or method”. and it is pointing the line

$('#'+dialogId).dialog(

of registerModalDialog() function. We are using struts1.x and our project is deployed in websphere6.5.

Thanks in advance for any help.

1

There are 1 best solutions below

1
On

jquery-ui.custom.js may not contain a widget dialog. Are you sure he was selected on the page http://jqueryui.com/download/ when you receive jquery-ui.custom.js?

Try execute

$().dialog()

on your page with

<script language="javascript" type="text/javascript"
        src="../js/common/jquery-1.9.1.js"></script>
<script language="javascript" type="text/javascript"
         src="../js/common/jquery-ui.custom.js"></script>

Any errors?