You have a LOT of non-jquery code in here.  My advice?  Don't expect
the community to solve this for you.  Take a step back and read the
jQuery documentation.  When you need to have community input, narrow
your code down to what works, then add features until it breaks.

The first documentation you should familiarize yourself with is jQuery
selectors.  Statements like "document.getElementById
('iAppName').value;" can be drastically shortened by using jQuery
selectors.  I leave it as an exercise for the reader to see how this
is done.

Regexes are a poor idea for validating email addresses in any case.
If it is important to harvest a valid email, use a server side system
that mails the prospective user back a validation link.  If the link
is not clicked, the email is not stored on your site.

Lastly, you have a lot of styling information in your HTML.  For
clarity's sake this should be moved to a CSS file.  There is a ton of
information out there that you desperately need to familiarize
yourself with before you tackle real world web design issues.  The
bare-bones but thorough site http://www.w3.org/TR/CSS2/ is a good
reference.

Good luck with your project!

On Jun 3, 6:52 am, Amit <amit.mca...@gmail.com> wrote:
> Hi Group ,
> I had a problem using jQuery and cakephp, I am submitting a form through the 
> jquery, on the click of an image.
> All validation is checked , data string is formed, success function works but 
> the url is not hitted , dont know why.Here is the javascript  code,<script 
> type="text/javascript">
> function CheckEmail(email)
> {
>     var filter = 
> /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
>     if(!filter.test(email)){
>         return false;
>     }
>     return true;
> }
> $(document).ready(function() {
>     $('#submitdiv').click(function(){   
>        
>     var iAppName = document.getElementById('iAppName').value;
>     var iName = document.getElementById('iName').value;
>     var iEmail = document.getElementById('iEmail').value;
>     var iSubmit = document.getElementById('iSubmit').value;
>     var iComment = document.getElementById('iComment').value;
>     var _str = '';
>    
>     if(iAppName == '' || iAppName == 'Application Name'){
>         _str += 'Please enter application name.'+"\n";
>     }
>     if(iName == '' || iName == 'Name'){
>         _str += 'Please enter your name.'+"\n";
>     }
>     if(!CheckEmail(iEmail)){
>         _str += 'Please enter valid email address.'+"\n";
>     }
>     if(iSubmit == '' || iSubmit == 'Subject'){
>         _str += 'Please enter subject.'+"\n";
>     }
>     if(iComment == '' || iComment == 'Comments'){
>         _str += 'Please enter your comments.';
>     }
>     if(_str.length > 0){
>         alert(_str);
>         return false;
>     }
>         var dataString = 'appname='+ iAppName + '&name='+ iName + 
> '&subject='+ iSubmit + '&email=' + iEmail + '&comment=' + iComment;
>        
>         $.ajax({
>             type: 'POST',
>             url: '/appstore/feature_myapp',  //appstore controller and 
> feature_myapp function
>             data: dataString,
>             success: function() {
>                 $('#feuappsdiv').append("<div id='message'></div>");
>                 $('#message').html("<h6 style='padding:5px 0 0 
> 20px;color:red;'>Request Submitted!</h6>")
>                 .fadeOut(5000, function() {
>                 });
>             }
>             });
>              $('#message').remove();
>        
>         });
>     });
> </script>
> Html Code is ::<div id="content_feature_app" class="content_feature_app">
>         <form id="fapp_form">
>               <div class="both paddbot2"><input type="text" id="iAppName" 
> name="AppName" style="width:148px;" size="38" maxlength="250" 
> value="Application Name" onfocus="clear_field(this);" 
> onblur="fill_field(this);" /></div>
>         <div class="both paddbot2"><input type="text" id="iName" name="Name" 
> size="38" style="width:148px;" maxlength="250" value="Name" 
> onfocus="clear_field(this);" onblur="fill_field(this);" /></div>
>         <div class="both paddbot2"><input type="text" id="iEmail" 
> name="Email" style="width:148px;" size="38" maxlength="250" value="Email" 
> onfocus="clear_field(this);" onblur="fill_field(this);" /></div>
>         <div class="both paddbot2"><input type="text" id="iSubmit" 
> name="subject" style="width:148px;" size="38" maxlength="250" value="Subject" 
> onfocus="clear_field(this);" onblur="fill_field(this);" /></h2></div>
>         <div class="both paddbot2"><textarea id="iComment" name="Comment" 
> rows="4" cols="17" onfocus="clear_field(this);" 
> onblur="fill_field(this);">Comments</textarea></div>
>         <div class="both paddbot2 marginTop10" style="width:148px;">
>             <div style="float:left;" class="pl5"><input type="image" 
> style="border:0px;cursor:pointer;" 
> onClick="javascript:document.getElementById('content_feature_app').style.display='none';"src="/img/appstore/close.gif"
>  name="submit" title="submit" alt="Close" /></div>
>             <div style="float:right;" class="pr5"><image id="submitdiv" 
> style="border:0px;cursor:pointer;" src="/img/appstore/submit.gif" 
> name="submit" title="submit" alt="submit" value="Submit" /></div>
>         </div>
>     </div>
>             </form>
> Any knid of help is appreciated.
> thanks--
>
> Regards,
>
> Amit Kr. SharmaProfile:  http://www.linkedin.com/in/amit2sharma
>
> Email id: amit.mca...@gmail.com
>
>  

Reply via email to