[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2010-08-17
6
Medium Priority
?
2,062 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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
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.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…
Suggested Courses

656 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