Connecting Tech Pros Worldwide Forums | Help | Site Map

Id Card Editing

Member
 
Join Date: Aug 2008
Posts: 40
#1: Apr 18 '09
I am doing an id card project using php/mysql and also i have many id card templates.If i click on any template,that particular id card should become editable and one should be able to change the personal details over the template.i must have text boxes specifying different fields on a side and if one enters the data in the text boxes that should be affected in the template id card..How is it possible.??Is there any tool to do this?or is it enough to do with javascript or ajax or flash actionscript?
Refer:www.photo-badge.com

Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,751
#2: Apr 18 '09

re: Id Card Editing


Hi.

Both JavaScript and Flash are capable of doing that.
Personally, I would go with JavaScript, because it doesn't require a 3'rd party plugin (the Flash player).

To do this with JavaScript, all you would have to do is set up your template in HTML, put input boxes somewhere (for the user to fill out), and have JavaScript mirror the changes to the input box on the template.

For example:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function updateTemplate(pTarget, pNewValue) {
  3.     var targetElem = document.getElementById(pTarget);
  4.     if(targetElem == null) { return false; }        
  5.     targetElem.innerHTML = pNewValue;
  6. }
  7. </script>
  8. <div id="Template">
  9.   <span id="tpl_Name">John Doe</span><br />
  10.   <span id="tpl_Title">Janitor</span>
  11. </div>
  12. <div id="UserInput">
  13.   Name: <input type="text" onkeyup="updateTemplate('tpl_Name', this.value);" /><br />
  14.   Title: <input type="text" onkeyup="updateTemplate('tpl_Title', this.value);" /><br />
  15. </div>
  16.  
See what I mean?
Reply