JavaScript - Javascript Code For Adobe Dynamic Stamp
Hello -
I am new to creating dynamic stamps in Adobe, but what I have at the moment is the following code pulling in the date automatcially for me: Code: event.value = (new Date()).toString(); AFDate_FormatEx("mm/dd/yy"); This is working great. Now what I need to do is put a set of initials in front of the date it is pulling in. And I have been successful with several sets of initials. Such as: Code: event.value = (new Date()).toString(); AFDate_FormatEx("BS mm/dd/yy"); But when I enter an "M" or "H", the dynamic stamp pulls in the current hour for H and the current minute for M. So I am wondering if there is another code I can implant within the dynamic stamp to put the initials right before the date?? Any help would be appreciated. Thanks, Brandy Similar TutorialsHiya, Ive been getting a form together that tallies billable parts for a service call. Each line has a quantity and a price and a subtotal. I have a grand total at the bottom that sums the subtotals. Everything is working fine, but I have a combo box that chooses whether the subtotal should zero out the field. So I would select Yes/No in the dropdown and it should change the subtotal to zero. That part is not working. Im using the following code which works without the Yes/No dropdown. Code: var L1 = "Cost.0"; var L2 = "Quantity.0"; var sum = 0; sum = this.getField(L1).value * this.getField(L2).value; f = this.getField("SubPrice0"); f.value = sum; This is what I am trying and cant get to work Code: var L1 = "Cost.0"; var L2 = "Quantity.0"; var sum = 0; sum = this.getField(L1).value * this.getField(L2).value; if (this.getField("Bill0") = "Yes") { f = this.getField("SubPrice0"); f.value = sum; } else { f = this.getField("SubPrice0"); f.value = 0; } Output in the combo box is Yes/No respectively. Any help would be appreciated. Sorry, its probably an easy thing that Im missing. Hello, I'm writing a web app to generate labels using user submitted data with Adobe Illustrator. I am editing the contents on a text frame in Illustrator using a JavaScript file. My method is as follows: Code: changeLayer = doc.layers.getByName(textKeys[t]); changeLayer.textFrames.getByName(textKeys[t]).wrapInside=true; changeLayer.textFrames.getByName(textKeys[t]).contents = textArray[textKeys[t]]; Basically, I set wrapInside to true and then I replace the contents of the Text Frame with a String. However, rather than wrapping the text as desired, Illustrator prints it all on one line and expands the size of the Text Frame (and Layer) to fit the text on one line. Even when I explicitly set the width and height of the frame in the script, it just shrinks the text to fit on one line in the frame, rather than wrapping it. If I explicitly set the font size it then expands the frame again, but only on one line. Any ideas?? Thanks in advance. I'm receiving the following errors: line 6 Expected an element name[xml] line 17 the input ended before all started tags were ended. last tag started was 'script'[xml] Code: <script type="text/javascript"> var camp = xfa.resolveNodes("camp[*]"); var total = 0; for (var i=0; i <= camp.length-1; i++) { if (camp.item(i).isNull) { total = total; } else { total = total + 30; } } this.rawValue = total; </script> I've got next to zero experience with javascript so not even sure what I should be looking to fix...any help is appreciated, if I need to answer something I missed, just let me know. Ok... so I just downloaded the new Adobe Edge program for creating HTML5 websites. I was trying out a proof of concept for something I wanted to do on a site with a simple circle shape (will eventually be a soccer ball) rolling across the screen when clicked. The animation looks great, but it happens when the page loads, not when the image is clicked. Any suggestions?? Thanks! My HTML Code: <!DOCTYPE html> <html> <head> <title>Untitled</title> <!--Adobe Edge Runtime--> <script type="text/javascript" src="edge_includes/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="edge_includes/jquery.easing.1.3.js"></script> <script type="text/javascript" src="edge_includes/edge.0.1.1.min.js"></script> <script type="text/javascript" src="edge_includes/edge.symbol.0.1.1.min.js"></script> <script type="text/javascript" charset="utf-8" src="ball_edge.js"></script> <link rel="stylesheet" href="ball_edge.css"/> <!--Adobe Edge Runtime End--> </head><body> <div id="stage" class="symbol_stage"> </div> </body> </html> ball_edge.css Code: /** * Adobe Edge(TM): Generated CSS * Do not edit this file. */ #stage { height: 560px; background-color: rgba(255,255,255,1); width: 931px; } #RoundRect1 { background-color: rgba(0,0,0,1.00); -webkit-transform: translateX(18.9112px) translateY(69.673px) rotate(0deg); -moz-transform: translateX(18.9112px) translateY(69.673px) rotate(0deg); -ms-transform: translateX(18.9112px) translateY(69.673px) rotate(0deg); -o-transform: translateX(18.9112px) translateY(69.673px) rotate(0deg); } .default_end_Default_Timeline #RoundRect1 { } ball_edge.js Code: /** * Adobe Helium: symbol definitions */ window.symbols = { "stage": { version: "0.1", baseState: "Base State", initialState: "Base State", parameters: { }, content: { dom: [ { id:'RoundRect1', type:'rect', rect:[234,175,81,82], borderRadius:[10,10,10,10], fill:['rgba(0,0,0,1.00)'], stroke:[0,"rgba(0,0,0,1)","none"], }, ], symbolInstances: [ ], }, states: { "Base State": { "#stage": [ ["style", "height", '560px'], ["color", "background-color", 'rgba(255,255,255,1)'], ["style", "width", '931px'] ], "#RoundRect1": [ ["color", "background-color", 'rgba(0,0,0,1.00)'], ["style", "border-bottom-left-radius", [41,41],{valueTemplate:'@@0@@px @@1@@px'}], ["transform", "translateX", '18.9112px'], ["style", "border-bottom-right-radius", [41,41],{valueTemplate:'@@0@@px @@1@@px'}], ["style", "border-top-left-radius", [41,41],{valueTemplate:'@@0@@px @@1@@px'}], ["style", "border-top-right-radius", [41,41],{valueTemplate:'@@0@@px @@1@@px'}], ["transform", "translateY", '69.673px'], ["transform", "rotateZ", '0deg'] ] } }, actions: { }, bindings: [ ], timelines: { "Default Timeline": { fromState: "Base State", toState: "", duration: 1000, timeline: [ { id: "eid32", tween: [ "style", "#RoundRect1", "border-bottom-right-radius", [41,41], { valueTemplate: '@@0@@px @@1@@px', fromValue: [41,41]}], position: 0, duration: 0, easing: "linear" }, { id: "eid30", tween: [ "style", "#RoundRect1", "border-top-left-radius", [41,41], { valueTemplate: '@@0@@px @@1@@px', fromValue: [41,41]}], position: 0, duration: 0, easing: "linear" }, { id: "eid18", tween: [ "transform", "#RoundRect1", "rotateZ", '360deg', { valueTemplate: undefined, fromValue: '0deg'}], position: 0, duration: 1000, easing: "linear" }, { id: "eid31", tween: [ "style", "#RoundRect1", "border-top-right-radius", [41,41], { valueTemplate: '@@0@@px @@1@@px', fromValue: [41,41]}], position: 0, duration: 0, easing: "linear" }, { id: "eid17", tween: [ "transform", "#RoundRect1", "translateX", '511.599px', { valueTemplate: undefined, fromValue: '18.9112px'}], position: 0, duration: 1000, easing: "easeInCirc" }, { id: "eid29", tween: [ "style", "#RoundRect1", "border-bottom-left-radius", [41,41], { valueTemplate: '@@0@@px @@1@@px', fromValue: [41,41]}], position: 0, duration: 0, easing: "linear" }] } }, }}; /** * Adobe Edge DOM Ready Event Handler */ $(window).ready(function() { $.Edge.initialize(symbols); }); /** * Adobe Edge Timeline Launch */ $(window).load(function() { $.Edge.play(); }); I've not done anything with JavaScript before, so I'm not sure what syntax error I'm committing. I have a form made in Acrobat 9 for the Mac, and on it there is a "submit via email" button. I want the resulting email, which will contain the filled out Acrobat form as an attachment, to use field from the form to populate the subject line and the CC address field. I've bodgered together some code from this Acrobat user's post, but in trying to customize it, my script has fallen apart. I think it should be a simple fix, but since I'm so new, I can't see it. My script so far is: Code: // This is the form return e-mail. Its hardcoded // so that the form is always returned to the same address // Change address on your form var cToAddr = "fogharty@xxx.xxx"; // First, get the client CC e-mail address var cCCAddr = this.getField("Teacheremail").value; // Set the subject and body text for the e-mail message var cSubLine = "this.getField("CourseNumber").value; + "corrections form submitted by " + + this.getField("TeacherName").value; var cBody = "\n Thank you for submitting your form.\n" + "Save the mail attachment for your own records"; // Send the form data as an PDF attachment on an e-mail this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr, cSubject: cSubLine, cMsg: cBody}); So I would like the subject line to read (CourseNumber) corrections form submitted by (TeacherName) Acrobat tells me I have a "SyntaxError: missing ; before statement 11: at line 12" but no matter how I tweak it, I keep getting that message. I put the semi-colon in, I take the semi-colon out, I put the semi-colon back in and shake it all about.... nothing. Any help someone could give me will be greatly appreciated, thanks Oh, and would there be a way to have the sent pdf form have it's name from a couple of fields as well? So that the attached file will be called "(CourseNumber).pdf"? ** edit so i managed to find a thread that removed the time stamp, all i need now is to change the date format and i'll be finished. thanks to Phillip_M for his post on that thread.** ========= hello i found this script for a datetime picker for a class project, which you can see he http://www.javascriptkit.com/script/...imestamp.shtml I want the date to be displayed as MMDDYYY instead of day-month-year this is the script below- Quote: function show_calendar(str_target, str_datetime) { var arr_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]; var n_weekstart = 1; // day week starts from (normally 0 or 1) var dt_datetime = (str_datetime == null || str_datetime =="" ? new Date() : str2dt(str_datetime)); var dt_prev_month = new Date(dt_datetime); dt_prev_month.setMonth(dt_datetime.getMonth()-1); var dt_next_month = new Date(dt_datetime); dt_next_month.setMonth(dt_datetime.getMonth()+1); var dt_firstday = new Date(dt_datetime); dt_firstday.setDate(1); dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7); var dt_lastday = new Date(dt_next_month); dt_lastday.setDate(0); // html generation (feel free to tune it for your particular application) // print calendar header var str_buffer = new String ( "<html>\n"+ "<head>\n"+ " <title>Calendar</title>\n"+ "</head>\n"+ "<body bgcolor=\"White\">\n"+ "<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+ "<tr><td bgcolor=\"#4682B4\">\n"+ "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+ "<tr>\n <td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar('"+ str_target+"', '"+ dt2dtstr(dt_prev_month)+"'+document.cal.time.value);\">"+ "<img src=\"prev.gif\" width=\"16\" height=\"16\" border=\"0\""+ " alt=\"previous month\"></a></td>\n"+ " <td bgcolor=\"#4682B4\" colspan=\"5\">"+ "<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">" +arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+ " <td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('" +str_target+"', '"+dt2dtstr(dt_next_month)+"'+document.cal.time.value);\">"+ "<img src=\"next.gif\" width=\"16\" height=\"16\" border=\"0\""+ " alt=\"next month\"></a></td>\n</tr>\n" ); var dt_current_day = new Date(dt_firstday); // print weekdays titles str_buffer += "<tr>\n"; for (var n=0; n<7; n++) str_buffer += " <td bgcolor=\"#87CEFA\">"+ "<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"+ week_days[(n_weekstart+n)%7]+"</font></td>\n"; // print calendar table str_buffer += "</tr>\n"; while (dt_current_day.getMonth() == dt_datetime.getMonth() || dt_current_day.getMonth() == dt_firstday.getMonth()) { // print row heder str_buffer += "<tr>\n"; for (var n_current_wday=0; n_current_wday<7; n_current_wday++) { if (dt_current_day.getDate() == dt_datetime.getDate() && dt_current_day.getMonth() == dt_datetime.getMonth()) // print current date str_buffer += " <td bgcolor=\"#FFB6C1\" align=\"right\">"; else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6) // weekend days str_buffer += " <td bgcolor=\"#DBEAF5\" align=\"right\">"; else // print working days of current month str_buffer += " <td bgcolor=\"white\" align=\"right\">"; if (dt_current_day.getMonth() == dt_datetime.getMonth()) // print days of current month str_buffer += "<a href=\"javascript:window.opener."+str_target+ ".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+ "<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">"; else // print days of other months str_buffer += "<a href=\"javascript:window.opener."+str_target+ ".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+ "<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">"; str_buffer += dt_current_day.getDate()+"</font></a></td>\n"; dt_current_day.setDate(dt_current_day.getDate()+1); } // print row footer str_buffer += "</tr>\n"; } // print calendar footer str_buffer += "<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+ "<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+ "Time: <input type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+ "\" size=\"8\" maxlength=\"8\"></font></td></tr>\n</form>\n" + "</table>\n" + "</tr>\n</td>\n</table>\n" + "</body>\n" + "</html>\n"; var vWinCal = window.open("", "Calendar", "width=200,height=250,status=no,resizable=yes,top=200,left=200"); vWinCal.opener = self; var calc_doc = vWinCal.document; calc_doc.write (str_buffer); calc_doc.close(); } // datetime parsing and formatting routimes. modify them if you wish other datetime format function str2dt (str_datetime) { var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\\d+)\\d+)$/; if (!re_date.exec(str_datetime)) return alert("Invalid Datetime format: "+ str_datetime); return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6)); } function dt2dtstr (dt_datetime) { return (new String ( dt_datetime.getDate()+"-"+(dt_datetime.getMonth()+1)+"-"+dt_datetime.getFullYear()+" ")); } function dt2tmstr (dt_datetime) { return (new String ( dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds())); } any help is appreciated ive been at this for two days with no result. thank you I am a newbie in terms of website design and animation. I want to do a animation that can random show my image when I click the mouse . And I use Adobe Edge to do my animation. I used the javascript of Math.random() but it doesn't work. I think this methods is wrong. Can anyone give me some help??? Thank you. Hey there CF members, i have a huge problem with dynamic JavaScript i am using .load function which is the part of my script built by my programmers to load objects dynamically in JS. the code reads PHP Code: $("#content").load("SOME CODE HERE",hideUpdate); The division id is Content as u can see above. the need is to add a html code at the beginning of it like in php we can use dot operator like "SOME CODE IS " . $ code same way what can we use in here in dynamic html to combine a custom HTML regards I have this piece of javascript code, which enables me to get my Picasa photos without link back feature, in my webpage. The issue is with the hardcoded RSS url feed. I want this to be dynamically passed as a variable to the java script. I use a PHP code, where this javascript is coded. In the below code, if I say var samples = <?php $url_code ?>, the javascript does not recognize. Can someone help on this, as I use the same PHP code, with different url feeds, to display different picasa photo albums ? Code: <script type="text/javascript"> function load() { var samples = "https://picasaweb.google.com/data/feed/base/user/......................../........./.........?alt=rss&kind=photo&authkey=.....................&hl=en_US" var options = { numresults: 2, scaleimages: true, maintainAspectRatio : false, displayTime: 1000, transistionTime: 300, //linkTarget : google.feeds.LINK_TARGET_BLANK }; new GFslideShow(samples, "slideshow", options); } google.load("feeds", "1"); google.setOnLoadCallback(load); </script> Hi, I'm trying to create a dynamic form using Javascript. This form essentially needs to collect data through certain fields and populate another. Code: <input name="Field1" type="text" /> <input name="Field2" type="text" /> <input name="Field3" type="text" /> <input name="Field4" type="text" /> <input name="Field5" type="text" /> Field 6 value = answer I'm stuck on how to go about this. I'm assuming I need to create multiple conditions to check each field and then output to a text box? Code: if ((document.thisform.Field1.value == null) && (document.thisform.Field2.value == null)) { I've done a bit of searching around but can't find anything with particular reference to this exact requirement, only brick level functions. If I have left anything out, or if it's all amiss, please let me know. Hello, I've used the concept from this website to build a form. http://www.enviromark.ca/english/quoteform.html Notice how the second drop down options change depending on what option is selected in the first drop down. Here's the Javascript Code: var Option1_Array = new Array("Choose a version", "1", "2"); var Option2_Array = new Array("Choose a version", "3", "4"); function program(objProgram) { var objVersion = objProgram.form.Version; var selectedArray = window[objProgram.options[objProgram.selectedIndex].value.replace(/\s/g,'') + "_Array"]; objVersion.options.length = 0; for (var i=0; i < selectedArray.length; i++) { objVersion.options[i]=new Option(selectedArray[i], selectedArray[i].replace(/->\s/g, "")); } } Here's the HTML Code: <form> <select name="Program" onChange="program(this)"> <option value="Start">Please choose a program</option> <option value=Null>---------------------------------------></option> <option value="Option1">1</option> <option value="Option2">2</option> </select> <select name="Version" onChange=""> </select> </form> Now, this code works perfectly, and does exactly what I want it to. BUT I'd like to add more fields that accomplish the same thing. For example choose option1 --> version 2 --> type 3 --> thing 5 Now, in order to do this I believe you need to generate a 'value = "a_value"' in the generated html option and select fields. That way, all you need to do is make separate functions for each level and the function can call the 'value' html attribute to handle each <select> depending on its declared value. If this is the best way (it sounds a little sketchy to me) then any help would be great. Or, if you can add on more child selection options within one function. Thanks, -Matthew Hi, I'd like to create a textarea and a division so that whatever embed code you put in the textarea it gets executed on the division in real-time. Your kind help is greatly appreciated! JavaScript newbie Hello, I have been noticing a really cool trend on the web and it is called the javascript carousel. Not the one from dynamic Drive. Here is an example of what I am talking about; carousel http://food.yahoo.com/;_ylt=AtuShzEA...hz75HDg9VIY.Y5 check on the bottom of the page where it says "try these recipes" I just love the circle indicating how many "pages there are. Do you know where I can find the tutorial or script for this effect? Thanks, Creations_Kash Hi everyone, i am stuck at a problem. i am trying to craete a redimmensionable array using javascript, is there a way to do this, i know that this can be done in vbscript using redim and preserve commands. If not then is it possible to variables between javascript and vbscript, or call vbscript function using javascript. a sample code will be much aprreciated thanks for your time! J hi friends, I am looking for a solution to display the records of a dynamically selected mysql table using ajax,jsp & js combinations. any sites showing some example thnx in advance. Hello everyone, I was wanting to know how you add links to Adobe Lightroom gallery photos? Here is the xml gallery code I am trying to add links to: <?xml version="1.0" encoding="UTF-8"?> <simpleviewerGallery maxImageWidth="1024" maxImageHeight="1024" textColor="0xFFFFFF" frameColor="0xFFFFFF" frameWidth="1" stagePadding="40" thumbnailColumns="2" thumbnailRows="3" navPosition="left" title="" enableRightClickOpen="true" backgroundImagePath="" imagePath="images/" thumbPath="thumb/"> <image> <filename>1.jpg</filename> <caption></caption> </image> <image> <filename>2.jpg</filename> <caption></caption> </image> <image> <filename>3.jpg</filename> <caption></caption> </image> <image> <filename>4.jpg</filename> <caption></caption> </image> <image> <filename>5.jpg</filename> <caption></caption> </image> <image> <filename>6.jpg</filename> <caption></caption> </image> <image> <filename>7.jpg</filename> <caption></caption> </image> <image> <filename>8.jpg</filename> <caption></caption> </image> <image> <filename>9.jpg</filename> <caption></caption> </image> </simpleviewerGallery> I have Adobe Lightroom 3. So far browsing through various tutorials and help notes I have not found a way to do this. However, I am hoping there is in fact a way to do this. Here is the actual flash simpleviewer gallery uploaded I have uploaded for a visual example. http://www.iandmyself.me I would simply like to add links to the photos once they are clicked. I have a signup form on a site that does a check on submission of fields to see if they populated and error box if not changes focus to missing field and highlights field name in red. I wanted to improve on its effectiveness as it only checks 2 fields atm and I wanted it to check some dynamic fields as well the fields are associative arrays generated via php as follows:- Code: echo "<select name='nfield[$t]'>\n"; for ($i = 0; $i<count($value2); $i++) { echo "<option value=\"".trim($value2[$i])."\">".trim($value2[$i])."</option>\n"; } echo "</select>"; the javascript is as follows:- Code: function checkForm() { //This is the name of the function if (Form1.password.value == "") { alert("Please enter a Password."); Form1.password.focus( ); document.getElementById('password').style.color="red"; return false; } The field is displayed via php as follows:- echo "<tr><td align='center' id='password'>Password:</td><td><input type='password' name='password' size='10'></td></tr>\n"; So i thought ah easy, i will just add the following checking javascript to check each of the associative arrays as they never change Code: if (Form1.nfield[1].value == "") { alert("Please choose an option for option1"); Form1.nfield["1"].focus( ); //This focuses the cursor on the problem field document.getElementById('nfield[1]').style.color="red"; return false; //This prevents the form from being submitted } if (Form1.nfield[2].value == "") { alert("Please choose an option for option2"); Form1.nfield[2].focus( ); //This focuses the cursor on the problem field document.getElementById('nfield[2]').style.color="red"; return false; //This prevents the form from being submitted } if (Form1.nfield[3].value == "") { alert("Please choose an option for option3"); Form1.nfield[3].focus( ); //This focuses the cursor on the problem field document.getElementById('nfield[3]').style.color="red"; return false; //This prevents the form from being submitted } but this doesn't work, i think it doesn't recognise the nfield[1] syntax, can a javascript guru point me in the right direction ? I also wanted to enhance the form somewhat as atm it only displays one error popup at a time, so if the user has missed out a few fields they will get an initial popup, try and submit again and then get the second popup for the other missing field. Can my code be modified to show a list of the missing fields and highlight all the titles in red (and if possible change the background colour of the input boxes or border the input fields in red etc)? |