A "preview" checkbox with JavaScript

Hi friends.
I´m writting a JavaScript that sends the active document in an appropriated way to print. Before calling the print command, I wanna display a dialog box asking the number of copies to print. So I thought I could also use this box to show some "auto" adjustments options (for example "auto levels"). If the user active "Apply auto-levels" then image refreshes to show the result (like a live preview). If user disables this box, then auto levels must be retired from image.
Well..hope you do not laught on my solution. The way I found to do it is..apply auto levels and refresh when user enables the field, and return in the history and refresh if the user disables this field. It get the expected result. BUT, if I have more checkboxes in the same dialog box, then this solution will not work so well (sure).
Do you have any other consistent solution to have previews of commands, but retire if the user disables the field?? Would like to learn a little about it.
Well..what I do (the solution I´ve mentioned above) is:
var doc = app.activeDocument;
var c = doc.activeLayer;
var dial = new Window ("dialog", "Print", undefined, {closeButton:false});
dial.orientation = "column";
dial.alignChildren = "fill";
dial.margins = 20;
var dPanel = dial.add ("panel", undefined, "Print options:");
dPanel.orientation = "column";
dPanel.alignChildren = "left";
dPanel.margins = 15;
var aLevels = dPanel.add ("checkbox", undefined, "Apply auto levels");
var dGroup = dial.add ("group", undefined);
dGroup.orientation = "row";
dGroup.alignChildren = "left";
var st = dGroup.add ("statictext", undefined, "Copies:");
var nField = dGroup.add ("edittext", undefined, "1");
nField.characters = 10;
var gButtons = dial.add ("group", undefined);
gButtons.orientation = "row";
gButtons.alignChildren = ["right", "right"];
var exe = gButtons.add ("button", undefined, "Execute", {name:"ok"});
var canc = gButtons.add ("button", undefined, "Cancel", {name:"cancel"});
aLevels.onClick = function (){
    if (aLevels.value){
        c.autoLevels();
        app.refresh();
    else
    if (! aLevels.value){
        doc.activeHistoryState = doc.historyStates[doc.historyStates.length-2];
        app.refresh();
dial.show();
Any idea to forget all of this and make a real "preview" checkbox?

Hello Gustavo,
I've been using (or seen using) preview in a couple of ways:
1. Nesting when possible adj.layers into Groups and toggling their visibility and/or using smart filters on smart objects;
2. Adding, and switching from, history states. Which is handy because you don't toggle only between original and "filtered", but if the UI of your script permits it, between original, "filtered with settings #1", "filtered with settings #2", etc. giving to users the extra feature of comparison.
An option similar to #2 (that I've adopted when the processing is particularly elaborate) is to duplicate the original doc, work on it and paste back the result as a new layer. You can use the same strategy of multiple settings previews there too, but without the need to resort to snapshots.
I've been working for a while on an embedded preview (in the ScriptUI window) but never found a robust workflow for it.
Cheers
Davide Barranca
www.davidebarranca.com

Similar Messages

  • Checkbox with javascript unexpectedly unchecks other checkboxs

    Hi,
    I have a checkbox called applicant_isemailaddress which has onchange javascript
    if (this.rawValue) {Page1.doYouEmail.presence = "visible";Page1.applicant_allEmailAddresses.presence = "visible";}else {Page1.doYouEmail.presence = "hidden";Page1.applicant_allEmailAddresses.presence = "hidden";};
    when checkbox applicant_isemailaddress goes to the "on" state, then two other checkboxs on the page get unchecked.
    they are called applicant_isMaleSex and applicant_isFemaleSex, I've tried changing the names to no benefit.
    removing the above javascript fixes the behaviour
    whats the trick??
    tia.
    Brian

    its possible I am a newbie.
    I put the whole page in the masterpage page1.
    moving it to page1 as a page, not a masterpage, it works well.
    thanks for comment, it did make me think further what was I doing wrong.

  • Same as above checkbox with javascript

    Hey all, I'm trying to set up a billing form in Acrobat Pro.  I have two address areas but I have a Same as Above checkbox to allow the user to copy their billing address to the shipping address.  I'm not sure what scripting I need or where to put it but I want it to check whether or not the box is checked, and if so, copy the billing address information to the shipping address area and lock them for editing.
    Here are the fields I have:
    BillingFullName
    BillingAddress1
    BillingCity
    BillingState
    BillingZip
    ShippingFullName
    ShippingAddress1
    ShippingCity
    ShippingState
    ShippingZip
    and my checkbox SameAsAbove.
    Thanks!

    Here's what I'd do:
    In the MouseUp event of the checkbox (named 'SameAsAbove' here), put the following:
    this.calculateNow
    In the 'Calculate' event of the ShippingFullName field (and all other shipping fields), put the following:
    event.value = event.value
    In the 'Format' event of the ShippingFullName field (and all other shipping fields), put the following:
    if (this.getField("SameAsAbove").value == 'Yes') {
    event.value = this.getField("BillingFullName").valueAsString
    This way, if they click the 'SameAsAbove' checkbox it will display the billing address (without changing the shipping value they may have entered), but if they uncheck it, the original shipping value entered is shown.
    Edit: the CalculateNow command may not be necessary, but it doesn't hurt to keep it in
    Edit2 to add 'valueAsString' as suggested by George above.

  • Hi, Just switched from CS6 to PS CC. I am used to using ACR in CS6 with it's preview checkbox in the upper  right-hand corner. I do not see that checkbox in PS CC. I see that they have added side-by-side, right and left and top and bottom before and after

    Hi,
    Just switched from CS6 to PS CC. I am very comfortable using ACR in previous versions. I liked to use the preview checkbox located in the upper right-hand corner to see before and afters. That checkbox is no longer in my version of PS CC. I see that they have side-by-side, top and bottom and right and left before and after options in the lower right-hand corner in this version. Is there anyway to get that legacy preview checkbox back so that I can use it?

    Hi Warunicorn,
    Thank you very much. I just could not find it on my own. I will have more questions as I get into it.
    Jim

  • Overprint preview setting in Javascript

    Hello-
    I'm trying to control Acrobat 7's preferences through a javascript, specifically, the overprint preview checkbox.
    In the past I've used
    if(app.runtimeHighlight)
    app.runtimeHighlight = false;
    to control field highlighting.
    I hoope there's a similar setting for overprint preview.
    thanks for any help!
    Ralph

    there is not.
    With the newer versions of Acrobat, you don't even need to worry about it. So just upgrade...

  • Can I with Javascript force Chrome users to open a PDF with Acrobat

    I have built a document in InDesign and exported to an Interactive PDF. I originally had issues with acrobat highlighting interactive buttons with a blue box but was able to get around this with a couple simple JavaScript lines that disabled this feature then re-enabled on closing. You can view the thread with my resolution here:
    Button Highlight in Interactive PDF from InDesign CC
    Great but now I have another issue. If the user opens with Chrome and has not disabled "Chrome's" PDF viewer the above JavaScript is ignored or not functional. It there a way with JavaScript or some other method to force the PDF to be opened with Acrobat in Chrome?
    I Miss FLASH this project would have been 100 times easier with action script and consistent across browsers ... curse you Steve Jobs.

    You need to not just think about Chrome. There is
    - FireFox
    - Microsoft Reader (comes with Windows 8)
    - Preview (comes with Mac)
    - iPad native PDF viewe
    - Android native PDF viewer
    Anyone getting a computer or tablet today can read PDFs without getting Adobe Reader and you need to give them a pretty compelling reason for them to download Adobe Reader to do what (they believe that) they can already do. I think it's the death knell for PDF forms.

  • Change Tooltip with Javascript

    i want to change the tooltip-text with javascript.
    is there a way to do that?
    i have a lot of checkboxes and want to change the caption AND tooltip with javascript from an array. it works fine with the caption-text
    thanks
    herbert

    Hi,
    Try this.
    this.assist.toolTip.value = "Hi from Avoka";
    Regards
    Philip

  • Accessing HTMLB checkbox in javascript

    Hi,
    I have the following scenario:
    1) jsp "main.jsp" has a checkbox with id="chkBoxId"
    2) In this "main.jsp" at the end, there is a jsp include
       including another jsp "buttons.jsp" - which contains a
       SUBMIT button.
    3) On this SUBMIT button, I am calling a javascript
       function "check()" in the "onClientClick" attribute.
    4) In this "check()" function I want to access the
       checkBox (present in "main.jsp")
    Now when I try doing this using the following code in the check() function, it gives me a "Undefined is null or not an object".
    function check(chkBoxId) {
    var funcName = htmlb_formid+"_getHtmlbElementId";
    func = window[funcName];
    var chkBox1 = eval(func(chkBoxId));
    // The checkbox is obtained
    if (chkBox1)
      alert("Not Checked");
    Plzz help me !!!
    regards,
    Jitendra

    HI,
    U can write the javascript function in the header tag or create a .js file in which u write the javascript code.
    the javascript code can be like
    function ValidateForm()
    if(document.form1.s_material.value=="")
    alert("enter material");
    return false;
    return true;
    where form1 is id of form and s_material is iD of input field.
    In your coding for button onClientClick like :
    <htmlb:button  id="s_but_submit"
                                       width="20"
                                       onClick="submit"
                                       onClientClick="if(!ValidateForm(this))htmlbevent.cancelSubmit=true;"
    Regards,
    Siddhartha

  • How do I redirect a secure zone login form with javascript?

    I would like to redirect what page a user goes to after filling out the secure log in form. I would change the landing page of the secure zone, but I need a log in form to go to a different page of the site. I would also create a seperate secure zone, but I have almost 3000 subscribers and it would be very time consuming to add all those users to this new zone.
    I would like to redirect the user (using the form from a secure zone) to a different page other than the landing page of the log in form. How do I do this with javascript?
    I saw this page: http://kb.worldsecuresystems.com/598/bc_598.html#main_Logging_into_different_Secure_Zones_ according_to_ID_number but couldn't make sense of it for my current situation. (I don't need multiple zones, just the form to redirect to a different page after submission)
    <form action="https://redlakewalleye.worldsecuresystems.com/ZoneProcess.aspx?ZoneID=12369&Referrer={module_siteUrl,true,true}&amp;OID={module_oid}&amp;OTYPE={module_otype}" method="post" onSubmit="return checkWholeForm52938(this)" name="catseczoneform52938">
                <div class="form">
                <div class="item"><label for="SZUsername">Username</label><br />
                <input type="text" maxlength="255" id="SZUsername" name="Username" class="cat_textbox_small" /></div>
                <div class="item"><label for="SZPassword">Password</label><br />
                <input type="password" autocomplete="off" maxlength="255" id="SZPassword" name="Password" class="cat_textbox_small" /></div>
                <div class="item"><input type="checkbox" id="RememberMe" name="RememberMe" /><label for="RememberMe">Remember Me</label></div>
                <div class="item"><input type="submit" value="Log in" class="cat_button" /> <a href="/_System/SystemPages/PasswordRetrieveRequest">Lost password?</a></div>
                </div>
                <script type="text/javascript" src="/CatalystScripts/ValidationFunctions.js"></script>
                <script type="text/javascript">
                    //<![CDATA[
                    function checkWholeForm52938(theForm){
                        var why = "";
                            if (theForm.Username) why += isEmpty(theForm.Username.value, "Username");
                            if (theForm.Password) why += isEmpty(theForm.Password.value, "Password");
                            if (why != ""){alert(why);
                                return false;
                       // Add the redirect code here?
                        theForm.submit();
                        return false;
                    //]]>
                </script>
            </form>

    I've been working on the same thing and have nearly solved it with these tutorials:
    http://www.bcgurus.com/tutorials/re-directing-users-to-the-correct-secure-zone
    http://www.bcgurus.com/tutorials/building-a-better-secure-zone-login-page
    The first tutorial will let a person continue on to the page he/she was attempting to access. For example, if your site offers learning lessons in a secure zone... A visitor could click on a lesson, get prompted to login and then be redirected to that particular lesson instead of the landing page for the secure zone.  The script in the tutorial also accommodates general logging in: "if the person wasn't going somewhere specific then send him/her here (landing page, user account, whatever).
    Might be worth checking out the free BCGurus trial or joining for a month.
    Brian

  • Open and Close Popup With Javascript

    Using Apex 3.2
    I have probably done this loads of times in my old job, but do not have access to the code and today I just can't get it to work properly.
    I have opened a pop up window with javascript
    Now I need to close it and refresh the calling page, but only if it passes the validation on the popup.
    I have a hidden item on my pop up called P7_FLAG.
    I have a page process after validation that sets P7_FLAG to (only set to 1, if passes validation).
    I also have a SUBMIT button.
    So once I click my SUBMIT button the page should look at the validations, if ok, set P7_FLAG to 1, then close the popup and refresh the calling page.
    My current javascript look like this
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>On my button
    javascript:saveChanges();The problem is that I need to click the SUBMIT button twice.
    First time it sets P7_FLAG
    Second time it closes page and refreshes.
    I have probably made some basic error, but today I cannot see it.
    Cheers
    Gus
    Edited by: Gus C on May 10, 2012 12:48 AM

    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>javascript does not wait for the current action to complete and then perform the next line.
    means in your function call
    doSubmit('SUBMIT');is triggered and it carry on's to next line that is
    $x('P7_FLAG').value;this will not be set because you are setting the value of P7_FLAG to 1 in plsql and trying to check in javascript, which will not work.
    what you need to do is amend your js function like below
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    </script>create a page branch to procedure and make it conditional to when P7_FLAG = 1
    and set the branch source to below
    htp.p('window.close();');
    htp.p('window.opener.doSubmit(''REFRESH'');');

  • Links that open a new window with javascript:void(null); do not work in 3.1

    I've been noticing that any site I go to that opens content in a new window with "javascript:void(null);" will be ignored by Safari 3.1. The links work in Firefox and used to work in Safari as well. Any suggestions?

    General rule of thumb in the Mac universe...
    When Safari is updated most if not all third party add-ons break. That's because most don't play by the rules. The developer thinks they know how to do it better than Apple so they just do it their way. So the first rule of survival is to KNOW what you have installed on your machine at all times. Use something like textedit to create a document listing all of the third party stuff you have installed and religiously update the list. Second rule is to wait a few days before applying an update. Third rule is to visit your third party developers' sites and make sure their little gadget is compatible with the new Safari update.
    Being aware of things will make life much easier for you in the long run.

  • How do I access the iTunes Preview page with a web browser?

    Does anyone out there know how to access the iTunes app preview page with a web browser?  So far the only way I've been able to get there is by Googling the app with the term 'iTunes preview'.  Is that really the only way?  The iTunes page itself has no obvious link to the app list.
    Thanks.

    Thanks, but I should have been more specific.  I was trying to access the iTunes app preview page on my PC through Chrome.  While I have an iPad, it's not convenient to have to refer to it every time I want to discuss an iOS app.

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • Problem with Javascript and opening a new page

    Hi,
    I'm developping a website with Java Server Faces.
    I've a problem with JavaScript.
    I have a table, and each row of that table, has a button, to display more information about that specific row. I want to display this information in a new window. For this I want to use JavaScript.
    The new window, of course, needs some information of the other window, to show the right data.
    The first time I click the 'more-information-button', it works perfectly, but from than on, he keeps showing the same information...
    Here is my jsp-page of the first page (the one with the table):
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
             <f:loadBundle basename="languages.MessageBundle" var="bundle"/>
            <html>
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>- UCV-Period -</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                        <h:dataTable binding="#{UcvPeriod.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd" rows="5"
                            style="left: 24px; top: 168px; position: absolute" value="#{UcvPeriod.dataTable1Model}" var="currentRow">
                            <h:column binding="#{UcvPeriod.column1}" id="column1">
                                <h:outputText binding="#{UcvPeriod.outputUcvPeriod}" id="outputUcvPeriod" value="#{currentRow['UCVPERIOD']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText2}" id="outputText2" value="#{bundle.ucvPeriod_columnHeader_ucvPeriod}"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{UcvPeriod.column11}" id="column11">
                                <h:commandButton action="#{UcvPeriod.btnDetails_action}" binding="#{UcvPeriod.btnDetails}" id="btnDetails" value="+" onclick="window.open('Details.jsp')"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText21}" id="outputText21" value=""/>
                                </f:facet>
                            </h:column>
                        </h:dataTable>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>Here is my action, when someone clicks on the 'more-information-button':
    public String bthnDetails_action() {
       Object s = outputUcvPeriod.getValue();
       BigDecimal ucvPeriod = (BigDecimal)outputUcvPeriod.getValue();
       this.getSessionBean().setUcvPeriod(new Integer(ucvPeriod.intValue());
       return "detail_ucvperiod";
    }Here is my constructor of the Detailspage.
        public Details() {
             this.txtUcvPeriod.setValue(this.getSessionBean().getUcvPeriod());
        }Here is the navigation part for this part of my faces-config.xml .
    <navigation-rule>
       <from-view-id>/UcvPeriod.jsp</from-view-id>
       <navigation-case>
           <from-outcome>detail_ucvperiod</from-outcome>
           <to-view-id>/UcvPeriod.jsp</to-view-id>
       </navigation-case>
    </navigation-rule>Thx a lot....
    Anneke

    See the tutorial "Sharing Data Between Two Pages" at http://devservices.sun.com/premium/jscreator/standard/learning/tutorials/data_sharing_twopages.html and the FAQ "How can I pass data between pages without creating SessionBean variables in Creator?" at http://devservices.sun.com/premium/jscreator/standard/reference/faqs/technical/javasource/passing_data.html. Since you can open a new window when your button is clicked, the tutorial and FAQ will explain ways to pass your data to the new window.

  • Problem with JavaScript in URL iView

    Hi,
    I am facing a problem with javascript when i am trying to access my application through URL iView. In the javascript window.top is used to access the frames in the window. But the EP is not recognizing it as valid. what exctly the problem and please suggest me a solution.
    Ashok.

    Hi,,
    thanks for the quick reply. But what i asked was different. I will put it in different way. I have deployed a application in Web Application Server and trying to access it through URL iView. My application is pure J2EE application with html,jsp and JS files. In javascript we used window.top property of the java script which is working fine MS IE. The problem is window.top is a IE specific property which is not having any equallent open standerd so EP is throwing a java script error. As I know the only possible solution for this problem is inherating IE rendaring capabilities to iView(i.e iFrame). is there any way to do that?
    Ashok.

Maybe you are looking for

  • Scan to Computer problem HP Officejet Pro 8500 (A909a) OSX 10.7.5

    Good afternoon, First of all I appologize if this question already has been asked a thousand times, but I am unable to find a solution in the somewhat simular stories. But reading thru all off them, while English is not my native language, was beginn

  • Elements 5 on Vista will not open. Missing files

    I have installed Photoshop elements 5.0 and the updater 5.02. Elements will not open and indicates several missing files. This is a brand new Windows vista HP machine. the missing files are "FAST CORE ROUTINES MODULE" , 'MMX CORE ROUTINES MODULE" , a

  • How to embedd Fusion Charts with XML files in java? Please help me.......

    Hi....iam trying to display Fusion Charts. Iam using Hibernate to bring data from database. what i want to do is to put data on xml, once my xml gets dynamic data from database, then it will be clubbed with swf files(fusion charts) to show graphs suc

  • VK11 Condictions

    My client wants to register a price in VK11 for condition PR00 (example) and he wants that this condition be free on the pricing  when the user is creating a Sales Order. But he wants to control what were changed in PR00 bt the user it they do that,

  • Multiple Physical Drives in PC

    I have a Windows 8.1 PC that I have used with 3 physical drives installed (80GB for OS, 1TB for storage, 40GB for other stuff). They are all SATA drives. My MOBO supports 6 SATA connections. I tried to add two more SATA drives to the PC (250GB and 50