• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript confirm onclick event using smook.js

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using smook.js for confirmation from user. i want to get a record id in the javascript function defined for smook.js like below. once user confirms, i can deleted that record.
THis is my JSP script part:

<script>
function tstconfirm(){
smoke.confirm('Are you sure you want to delete this record?',function(e){
if (e){
smoke.alert('Confirmed');
// Want to get the selected record ID here, so that i can call a ajax request to delete the record.
}else{
smoke.alert('Canceled');
}
});
}
</script>
This is my JSP body part:
<div>
<ul id="mytitle">
<li>
<p id="r_id">Record Id</p>
<p id="r_nam">Record Name</p>
<p id="r_des">Record Description</p>
<p id="r_typ">Record Type</p>
<p id="r_action">Delete</p>
</li>
</ul>
<ul id="mylist">
<c:if test="${!empty allrecorddata}">
<c:forEach items="${allrecorddata}" var="recordInfo">
<li>
<a href="editrecord.html">
<p id="r_id">${recordInfo.getId()}</p>
<p id="r_nam">${recordInfo.getName()}</p> // Record Name
<p id="r_des">${recordInfo.getDesc()}</p>
// Record Description
<p id="r_typ">${recordInfo.getType()}</p>
// Record Type
<p id="r_action"><a class="delete" onclick="javascript:tstconfirm();">Delete</a></p>
</a>
</li>
</c:forEach>
</c:if>
</ul>
</div>
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can find no information about smook.js; what is it?
 
Ravish Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:I can find no information about smook.js; what is it?



http://smoke-js.com/
 
Ravish Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I could able to resolved bit as, on my java script call i m passing the record id as :
onclick="javascript:tstconfirm('${recordInfo.getId()}');"


and java script method written as :

function tstconfirm(recId){
smoke.confirm('Are you sure you want to delete this record?',function(e){
if (e){
smoke.alert('Confirmed');
alert(recid); // This place I am able to get the correct record id
// here i can call the ajax function to delete the record.
}else{
smoke.alert('Canceled');
}
});

Now issue i am facing is alert "Confirmed" and alert(recid) display simultaneously, at this point browser not waiting Confirmed event from user, it goes ahead and print alert(rec id) too. It means that record gets deleted without user select "Confirmed". what if user decide to not to delete it using "Esc" button from key board.
}
 
We're all out of roofs. But we still have tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic