Hello fellows,
I’m finishing develop my website for mobile but one action that I have is the delete option and in the web version I’m using dialog to confirm the delete action and works very well but when I’m running my app in the iPhone browser the dialog doesn’t show up and I’m not able to delete what I need.
Does any one have a clue in how can I solve that?
Regards
alirz23
(Alirz23)
September 19, 2012, 8:27pm
3
make use of Unobtrusive JavaScript fall back to normal delete call if javascript does not work
That’s what I’m thinking, it’s really weird. That’s my code:
<?php echo CHtml::link(
'Delete',
'#',
array('submit'=>array('delete','id'=>$model->id),
'params'=>array('returnUrl'=>'index.php?r=notes/index'), 'confirm' => 'Are you sure that you want to delete ' . $model->title . '?')
); ?>
Thanks man but can you be more specific because I’m still not a Yii expert and neither Javascript.
Can you give me some code examples or something like that?
alirz23
(Alirz23)
September 19, 2012, 8:35pm
6
this should work even if you have javascript disabled
16 <?php Yii::app()->clientScript->registerCoreScript("jquery"); ?>
17 <script type="text/javascript">
18
19 $(document).ready(function(){
20 $('#deleteLink').click(function(){
21 confirm("are you sure?");
22 });
23 });
24
25 </script>
26
27 <?php echo CHtml::link("Delete", array("site/admin"), array("id"=>"deleteLink")); ?>
28
alirz23:
this should work even if you have javascript disabled
16 <?php Yii::app()->clientScript->registerCoreScript("jquery"); ?>
17 <script type="text/javascript">
18
19 $(document).ready(function(){
20 $('#deleteLink').click(function(){
21 confirm("are you sure?");
22 });
23 });
24
25 </script>
26
27 <?php echo CHtml::link("Delete", array("site/admin"), array("id"=>"deleteLink")); ?>
28
It doesn’t work! Work in the browser but not in the phone. I don’t know what to do anymore!
alirz23
(Alirz23)
September 19, 2012, 8:45pm
8
what are you using to test the mobile site?
iOS Simulator from XCode and also my phone.
My project is online. Do you have a phone with you so you can test?
If you do go www.ichurchnotes.com/notes and sign up and create a note and try to delete.
BTW this project still in BETA version.
alirz23
(Alirz23)
September 19, 2012, 9:00pm
10
something is up with your site buddy I would suggest you to set up a test project and see if it works then implement it in your actual site
I will try that. Thanks man
I just added
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
and now it shows the dialog but doesn’t delete anymore Neither in the web browser and the mobile.
It’s working now. I had to delete some javascript code. I guess that was a conflict