[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2072
  • Last Modified:

Internet Explore problem - Cakephp $form->submit with onclick function

Hi All,

I have a cakephp application
Pls check the following code in the ctp file listed below:-
<script>
function validate()
{
//some code
return false;
}
</script>
<?php
echo $form->submit("images/but_save.jpg", array( "alt" => "Save",'onclick'=>'javascript:return validate()','width'=>'80','height'=>'25', 'url' => "edit/", 'update' => array('dynamic2', 'dynamic3')));
?>
its working in firefox,oper etc, but not in Internet Explore, what is the issue?
No javascript error occures!.

Thanks in advance.
0
Web_Sight
Asked:
Web_Sight
  • 3
  • 3
1 Solution
 
SnarflesCommented:
I'm not familiar with cakephp...

We cannot assume that the validate function is working properly, especially with ie. Can you provide the code for this rather than just '//some code'.

Alternatively the best way to debug some javascript code is to use alerts

alert(variable_name);

Cheers
0
 
Web_SightAuthor Commented:
the code is listed below:-
if(document.getElementById('SupportOprequired')!=null)
    {
        var val= document.getElementById('SupportOprequired').value;
        if(val=="Yes")
        {
            if(trim(document.getElementById('SupportPonumber').value)=="")
            {
                alert("Must have PO Number from the customer before you can save the call.");
                document.getElementById('SupportPonumber').value = trim(document.getElementById('SupportPonumber').value);
                document.getElementById('SupportPonumber').focus();
                return false;
            }
            else
                document.getElementById('SupportPonumber').value = trim(document.getElementById('SupportPonumber').value);

        }

    }
0
 
SnarflesCommented:
Make sure that your elements have a name attribute as well as an id attribute.

eg id="SupportPonumber" name="SupportPonumber"

There is a bug with ie7 and ie6 where it takes the name attribute rather than the id attribute for getElementById

a bit typical isnt it.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Web_SightAuthor Commented:
Hi,
But the browser is ie8
0
 
SnarflesCommented:
Do you have a url I could look at?
0
 
Web_SightAuthor Commented:
good
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now