Solved

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

Posted on 2010-08-17
6
2,020 Views
Last Modified: 2013-11-10
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
Comment
Question by:Web_Sight
  • 3
  • 3
6 Comments
 
LVL 9

Expert Comment

by:Snarfles
ID: 33452473
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
 

Author Comment

by:Web_Sight
ID: 33452560
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
 
LVL 9

Accepted Solution

by:
Snarfles earned 500 total points
ID: 33452660
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:Web_Sight
ID: 33452744
Hi,
But the browser is ie8
0
 
LVL 9

Expert Comment

by:Snarfles
ID: 33452861
Do you have a url I could look at?
0
 

Author Closing Comment

by:Web_Sight
ID: 33602740
good
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now