OnClick problems

I'm having problems with this simple script that exports layer as images named after the layer name. The problem is the UI; I can't get the buttons to work properly. Either the cancel and ok buttons don't work or they both process the images. All or nothing.  Can someone please point out where I'm going wrong. Thank you.
app.preferences.rulerUnits = Units.PIXELS;
if (documents.length == 0) {
alert ("no documents open, dude!")
} else {
// call the source document
var srcDoc = app.activeDocument;
fileName = app.activeDocument.name;
// change this back to include the name of the source file as the base file prefix
// docName = fileName.substring(0,fileName.length -4)
var docName =""
var fileNum ="_";
var imageCount = 1
var numOfLayers = srcDoc.layers.length;
var layerRef = srcDoc.activeLayer;
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,460,270],"+
"statictext0:StaticText{bounds:[60,10,300,80] , text:'Saves out each layer as a file named after the corresponding layer name. (Optional) Set the prefix of the files to be saved. Leave blank to omit this prefix. (default)' ,properties:{scrolling:undefined,multiline:true}},"+
"EditText:EditText{bounds:[60,90,300,106] , text:'myfile' ,properties:{multiline:false,noecho:false,readonly:false}},"+
"decant:Button{bounds:[60,120,160,140] , text:'OK' },"+
"exit:Button{bounds:[200,120,300,140] , text:'Cancel' },"+
var win = new Window(dlg,'Decant images by layer name');
win.center();
win.EditText.text = docName;
win.show();
var myDocName = win.EditText.text;
win.exit.onClick = function(){
win.close(1);
win.decant.onClick = function(){
processLayers (srcDoc);
function processLayers (srcDoc) {
for (var i = numOfLayers -1; i >= 0  ; i--)
if (imageCount < 10)
  fileNum = "_0";
  else fileNum ="_";
srcDoc.activeLayer = srcDoc.artLayers[i];
// find the selected layer name and call it mySelectedlayer
//var thisLayer = app.activeDocument.activeLayer.name;
var thisLayer = srcDoc.artLayers[i].name;
if (srcDoc.activeLayer.isBackgroundLayer == false) {
// duplicate image into new document
// =======================================================
var id2784 = charIDToTypeID( "Mk  " );
    var desc707 = new ActionDescriptor();
    var id2785 = charIDToTypeID( "null" );
        var ref508 = new ActionReference();
        var id2786 = charIDToTypeID( "Dcmn" );
        ref508.putClass( id2786 );
    desc707.putReference( id2785, ref508 );
    var id2787 = charIDToTypeID( "Nm  " );
      desc707.putString( id2787, myDocName + thisLayer );
    var id2788 = charIDToTypeID( "Usng" );
        var ref509 = new ActionReference();
        var id2789 = charIDToTypeID( "Lyr " );
        var id2790 = charIDToTypeID( "Ordn" );
        var id2791 = charIDToTypeID( "Trgt" );
        ref509.putEnumerated( id2789, id2790, id2791 );
    desc707.putReference( id2788, ref509 );
executeAction( id2784, desc707, DialogModes.NO );
// Set filePath and fileName to source path
filePath = srcDoc.path + '/' + app.activeDocument.name + '.png';
// save out the image
var pngFile = new File(filePath);
pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.embedColorProfile = true;
pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
pngSaveOptions.matte = MatteType.NONE; pngSaveOptions.quality = 1;
activeDocument.saveAs(pngFile, pngSaveOptions, false, Extension.LOWERCASE);
// close that save png
app.activeDocument.close()
// selects document that's been open the longest
app.activeDocument = srcDoc;
imageCount ++;
//var mySourceFilePath = activeDocument.fullName.path + "/";
alert ("Done! " + (numOfLayers -1) + " images" + "\n" + "were successfully exported to:" + "\n" + "\n" + filePath.substring(0,filePath.length -6));
} //no documents open

Are the onClick functions even necessary?
But I create dialogs the other way (Edit: which is less elegant):
var dlg = new Window("dialog", "space with distance", [500,300,750,380]);
// field for entry;
dlg.distance = dlg.add("edittext", [15,15,110,35], "50", {multiline:false});
dlg.distance.active = true;
// ok- and cancel-button;
dlg.buildBtn = dlg.add("button", [13,45,118,68], "OK", {name:"ok"});
dlg.cancelBtn = dlg.add("button", [128,45,240,68], "Cancel", {name:"cancel"});
// show dialog;
dlg.center();
// show dialog;
var myReturn = dlg.show ();
// if ok;
if (myReturn == true) {
    alert (dlg.distance.text)
else {
    alert ("canceled")

Similar Messages

  • Button onclick problems with Firefox and Safari and lightroom template

    I am trying to use button onclick code in Lightroom. The code is located in the contact info box of the template. I am using the same code in two websites. www.jefffrankphotography.com (Lightroom template)] www.jefffrankproductions.com (1and1 template) If a user is using Firefox or Safari and clicks on the button it will work on the "productions" site but not on the "photography" site. IE works with both sites. Any help in the coding would be appreciated.
    Jeff Frank / 18:49 / 06_16_08

    In iWeb do Command-Shift-L to see the layout of the page.
    The content in the Navigation layer is blocking the content of the Header layer. The body layer is empty.
    Move ( +Use Command-drag+ ) EVERYTHING in the Navigation layer and EVERYTHING in the Header layer INTO the Body layer.
    Put content where it belongs.
    Message was edited by: Wyodor

  • Problem with asp:Button in PTWC 2.1 - onclick not rendering on second button

    I have a user control with two asp buttons in one TD tag (they both have ptrender=true on them). In the portal only the first button fires its event. The second button does not. I did a partial view source on the two buttons and I see this (button 1 in blue, button 2 in red):
    <TR><TD colSpan=3></TD></TR><TR><TD align=right colSpan=5><INPUT id=_ctl0_cmdSubmit onclick="if(PTWCControl_2_1.inlineSubmit('PTPortletDIV_4645')){__doPostBack_4645('4645','frmAdmin_4645','','', PTWCControl_2_1.extraArgs(this, 'submit', event));return false;}" type=submit value=Submit name=_ctl0:cmdSubmit ptrender="true"><INPUT id=_ctl0_cmdSubmitAddRewards type=submit value="Submit & Add Rewards" name=_ctl0:cmdSubmitAddRewards ptrender="true"></TD></TR>
    So for some reason the onclick event is only being added to the first button. The interesting thing is, if I drop a second TD tag around the second button, they both work fine. This issue just showed up recently. I'm fairly sure that multiple buttons has worked in lots of other cases. Has anyone see this problem before? Any ideas?

    The buttons are on the same line. I would like to upgrade to 2.2 and I'm sure that we will at some point, but it won't happen without some time dedicated to testing. I'd like to get this figured out with version 2.1. The strange part is that it just showed up after the portlet was enhanced. I looked at everthing changed and I can't figure out what could have caused it. Anyone have any idea what would cause 2 buttons in one TD tag not to both receive the onclick event?

  • CommandButton onClick() action problem

    Hi every one ,
    I want to execute an Ajax function when clicking on submit button before submitting the page like this :
    <h:commandButton value="Go" onclick="myFun();" action="#{myController.getPropertyName}"/>where this javascript function will show a yes/no message then an Ajax function will be executed according to the user choice.
    The problem is that the j.s function is not even executed but the action is submitted directly.
    And from what i understood is that JSF reserves onclick() function to execute "action" property, that's why it can't feel the onclick() i wrote.
    I also tried using onmousedown() instead but still the action is submitted directly.
    Any suggestions ?

    Hesham wrote:
    Yes, i thought so but i can't change the JSF version used in the project, so is there a way to overcome this ?Perhaps one of the other events fired by the button will be sufficient (e.g., onmouseup). You could also try to implement your own component for this.

  • Javascript onClick EJB method call problem

    Hi,
    I am using JDeveloper to develop a supermarket comparison tool. I have
    a JSP page called index.jsp which consists of a shopping list (shopping
    cart type thing) and an iframe which displays my search.jsp page. The
    search.jsp page is a list of all the items that can be added to the
    shopping list. When a user clicks the add button for the corresponding
    item, the cartBean addItem method is called and the itemID is passed
    through. I have 3 items currently in my product list with individual
    ID's, but when I click the add button on a particular item all 3 of the
    items are added to my shopping list. Can anyone tell me why? and if so how can I resolve this problem?
    Search.jsp:
    <%
        //Get the list of items
        ArrayList itemList = null;
        try {
          itemList = items.getItems("Select * from items");          
        catch (Exception ex) {
          System.out.println(ex.getMessage());
        %>
        <table class='resultsTable' cellpadding='10' cellspacing='10'><%
          for (Iterator iter = itemList.iterator(); iter.hasNext();){        
            ItemsEJBBean product = (ItemsEJBBean) iter.next();%>
                <tr>     
              <td><%="<img src='images/items/"+product.getItemImg()+".jpg' width='77' height='45'>"%></td>
              <td><h3><%= product.getItemName()%></h3><%= product.getItemDesc()%></td>
              <td><a href="#"><img src="images/add.gif" width="47" height="19" border="0" name="addButton<%=product.getItemId()%>" id="<%=product.getItemId()%>" onMouseOver="MM_swapImage('addButton<%=product.getItemId()%>','','images/add_hover.gif',1)" onMouseOut="MM_swapImgRestore()" onclick="<%/*addNewItem(product.getItemId());*/ list.addItem(new Integer (product.getItemId()));%>window.parent.location.reload(false);"></a></td> 
                </tr><%
          %>
          </table>
          <%CartBean code snippet:
    public void addItem(Integer itemID)
        if(getItemCount() < max)
          contents.add(itemID);
      public void removeItem(Integer itemID) throws ItemException
       boolean result = contents.remove(itemID);
        if(result == false)
          throw new ItemException(itemID + " not in list.");
        else
          contents.remove(itemID);
      public Vector getContents()
        return contents;
      public int getItemCount()
        if (contents == null)
          return 0;
        else
          return contents.size();
       public int getItemCountRemain()
        if (contents == null)
          return max;
        else
          return max - contents.size();
    }Any help would be most helpful. Thank you for your time :)

    but when I click the add button on a particular item all 3 of the
    items are added to my shopping list. Can anyone tell me why? and if so how > > can I resolve this problem?I don't think that clicking the button is what is causing your problem. The following line of code is the problem:
    <td><a href="#"><img src="images/add.gif" width="47" height="19"
    border="0" name="addButton<%=product.getItemId()%>" id="<%=product.getItemId()%>"
    onMouseOver="MM_swapImage('addButton<%=product.getItemId()%>','','images/add_hover.gif',1)"
    onMouseOut="MM_swapImgRestore()"
    onclick="<%/*addNewItem(product.getItemId());*/ list.addItem(new Integer (product.getItemId()));%>
    window.parent.location.reload(false);"></a></td> When you are trying to create the onClick, you are invoking list.addItem. You are doing this for each item. By the way, I don't think the resulting onClick will actually do anything. It will evaluate to the item id and nothing will happen. You need to trigger a request to the server here (e.g. by submitting a form and including the correct item id).

  • WebHelp OnClick Javascript problem

    Hello there,
    I wanted to insert an email feedback link into my webhelp file.
    So in my Master Page I added the following link in the header of the page:
    <a href = "Send feedback" onClick="parent.location='mailto:[email protected]?Subject=blah blah'"> </a>
    It works fine. THe link is displayed on all pages and when I click on it an email is generated. Problem is after I click on the link in webhelp, the page in the right of the frame i.e. the topic I'm viewing is refreshed and it says "Internet Explorer cannot display the webpage".
    Any ideas how I can fix this?
    Thanks

    Thanks,
    It doesn't work at all with that hehe
    It's a bit annoying basically I've found some javascript that should in theory allow me to let a user submit feedback and it will send the title of the page they are viewing. This is how its meant to work:
    <head>
    <script type="text/javascript">
    function getFileName() {
    //this gets the full url
    var url = document.location.href;
    //this removes the anchor at the end, if there is one
    url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#"));
    //this removes the query after the file name, if there is one
    url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?"));
    //this removes everything before the last slash in the path
    url = url.substring(url.lastIndexOf("/") + 1, url.length);
    //return
    return url;
    function EmailLink()
    topictitle=getFileName();
    document.write(topictitle);
    window.location = "mailto:[email protected] "+" ?subject= Re: Web Analytics help - "+ topictitle;"sometitle"
    </script>
    </head>
    <FORM>
    <a href = "E-mail" onClick="EmailLink()">Email </a>
    </FORM>
    So it works fine from within a web browser...but for some reason - it won't work from within webhelp when it's embedded into my master page

  • Problem to Spry - Jquery - Onclick

    Hello everyone,
    I have a problem with the onclick event that calls a function to populate a div jquery (Wishlist).
    The onclick event is in a Spry repeat that grabs data from an XML.
    In this example (http://beta.baybarb.com/test.asp) you can see two areas, one static with the onClick event on the image "wishlist" that works and fills the div with the data using jquery.
    The second zone is a dynamic area where the event is not working onClick = "return false" that populates the div's Wishlist. Logically, if I raise the onclick event calls the ASP page that processes and then returns data to populate the div.
    Solutions? how can I work around the problem
    Thanks

    did you ever solve this? I'm looking too...

  • Menu Problem with OnClick Values

    Hi, I am not able to resolve this, so I hope someone can
    point out my error, or point me in the right direction. I have a
    set of menu choices and have an imbedded onclick command to pass a
    desired value. Instead of getting a value of, 1, for the first menu
    item, the value of, 6, is passed. How do I get the correct value
    passed? I've copied a section of my menu code below:
    <LI class=first>
    <A href="DisplayCFP.cfm" class=first onClick="<cfset
    session.DKy = 1>">"About BOMA"</A></LI>
    <LI>
    <A href="DisplayCFP.cfm" onClick="<cfset session.DKy =
    2>">"Who is BOMA?"</A></LI>
    <LI>
    <A href="DisplayCFP.cfm" onClick="<cfset session.DKy =
    3>">"Membership Categories"</A></LI>
    <LI><A
    href="https://www.bomakc.org/RegisterNewMember.cfm">Join
    Online</A></LI>
    <LI>
    <A href="DisplayCFP.cfm" onClick="<cfset session.DKy =
    4>">"Leadership"</A></LI>
    <LI class=first>
    <A href="DisplayCFP.cfm" class=first onClick="<cfset
    session.DKy = 5>">"What We Provide"</A></LI>
    <LI><A
    href="ClassRegistration.cfm">Class Schedule &amp;
    Registration</A></LI>
    <LI>
    <A href="DisplayCFP.cfm" onClick="<cfset session.DKy =
    6>">"Continuing Professional
    Development"</A></LI>
    Thank you, in advance, for some help.

    Not sure what you want to achieve.
    CF is a server-side script. Setting session variables ,
    processing of inputs
    will be done at the server-side. The values of Cf variables
    are set when the
    code is parsed by the server. You would not be able to set
    session
    variables client-side as your code seems to suggest.
    Just as an example, say you want to send a value 1 to the new
    page when a
    user clicks a link, you could use
    <a href="DisplayCFP.cfm?id=1">About BOMA</a>
    At the receiving page, you could get the data with
    <cfset session.DKy = url.id>
    Passing url variables is not secure as the user can see the
    variable and can
    change the value in the address bar. If you can be more
    specific about what
    you want to achieve someone can suggest a solution. You may
    also want to try
    the CF forum.
    "jade2g" <[email protected]> wrote in
    message
    news:eoo4tf$7bf$[email protected]..
    >
    >
    > Hi, I am not able to resolve this, so I hope someone can
    point out my
    > error,
    > or point my in the right direction. I have a set of menu
    choices and have
    > an
    > imbedded onclick command to pass a desired value.
    Instead of getting a
    > value
    > of, 1, for the first menu item, the value of, 6, is
    passed. How do I get
    > the
    > correct value passed? I've copied a section of my menu
    code below:
    >
    > <LI class=first>
    > <A href="DisplayCFP.cfm" class=first
    onClick="<cfset session.DKy =
    > 1>">"About
    > BOMA"</A></LI>

  • Problem in calling window.open using onclick

    Would anybody please help to explain why it doesn't work for method 2?Now I am very headache as I cannot explain why this work to my boss.
    I want to popup a new window when clicking the logon image. Method 1 works fine, but no response for Method 2.
    Method 1:
    <A onclick="window.open(' https://www.dummy.com','test','width='+screen.width+',height='+screen.height*0.88+',location=no,directories=no,menubar=no,toolbar=no,scrollbars=yes,status=yes,resizable=yes,left=0,top=0'); " href="javascript:void(0)">
    <IMG alt=Logon src="logon.gif"></A>
    Method 2:
    <IMG alt=Logon src="logon.gif">
    function pws_logon_en() {
    pws_popupNewBrowser ('https://dummy.com', 'yes', 'no', 'yes', 'no', 'no', 'yes', screen.width, screen.height*0.9);
    function pws_popupNewBrowser(url, status, location, scroll, mbar, toolbar, resize, width, height, winname)
         !winname? winname='nb':winname=winname;
         nb=window.open(url, winname, 'status=' + status + ',location=' + location + ',scrollbars=' + scroll + ',menubar=' + mbar + ',toolbar=' + toolbar + ',resizable=' + resize + ',height=' + height + ',width=' + width + ',left=0,top=0');
         nb.focus();
    }

    > <IMG alt=Logon src="logon.gif">
    Where is popup() function in your method 2?

  • Problem in onClick attribute of the netui:anchor tag

    Hi,
    I have a String object to be passed to the javascript function with onClick attribute.
    eg: <%String st = new String("helo");%>
    <netui:anchor action="display" onClick="display()">
    I want to pass the object st to the java script so that I can do some validations. how can I do that. If I say,
    onClick="display('<%=st%>')" it is not working. can you please suggest me a solution.
    Regards,
    Satish.

    I haven't tried this with the netui:anchor tag, but it works with the netui:button tag.
    <%
    String onCl = "display('" + st + "')";
    %>
    <netui:anchor action="display" onClick="<%=onCl%>">
    Apparently, you can place a scriptlet inside the onClick attribute, but you cannot intermingle the scriptlet with plain text.
    Also, the onclick attribute appears not to support XScript ({request.whatever}). I find that weird.

  • Navigation Bar OnClick JavaScript Problem

    I tried to create a Navigation Bar to pop up a online help documentation. The sample application can be seen at
    http://apex.oracle.com/pls/otn/f?p=27294:1
    When I debugged the application, I found that the link of Help Navigation Bar points to "http://apex.oracle.com/pls/otn/f?p=27294:#:432121301146634::NO:::"
    not as what I defined on OnClick JavaScript for the navigation bar. The Help Window won't pop up.
    Please help. Thanks.

    Have a look at the following post:
    how to create a popup help page in html db

  • OnClick register problem

    would you please help me in this regards
    in nav bar have a button when click the button open a dialog box. threr have a three buttons.
    when click any one i need to catch that event and close the parent dialog box.
    // Set up the navigation bar
        function buildNavbar(doc)
            // retrieve the predefined NavBar object
            // the type defaults to "scriptui"
            var bottombar = doc.navbars.filesystem.bottom;
            // display it
            bottombar.visible = true;
            // set the height
            bottombar.height = 50;
            // add a ScriptUI display frame
            bottombar.pathPanel = bottombar.add( "panel", [5,5, 480,35], undefined);  // bounds = [left, top, right, bottom]
            // add UI components to the frame
            bottombar.pathPanel.browseField = bottombar.pathPanel.add( "statictext",[3, 3, 395, 22],"");
            bottombar.pathPanel.browseBtn = bottombar.pathPanel.add( "button",[400, 3, 465, 22],"Log In");
            bottombar.pathPanel.browseField.text = doc.thumbnail.path;
            // add the button's event handler, which navigates to the log in form
            bottombar.pathPanel.browseBtn.onClick = function()
                res = "dialog { \
                    info: Panel { orientation: 'column', alignChildren:'right', \
                                    text: 'Log In Info', \
                                    name: Group { orientation: 'row', \
                                                    s: StaticText { text:'User ID:' }, \
                                                    e: EditText { characters: 30 } \
                                    addr: Group { orientation: 'row', \
                                                    s: StaticText { text:'Password:' }, \
                                                    e: EditText { characters: 30, properties:{noecho:true}} \
                            buttons: Group { orientation: 'row', \
                                                      testBtn: Button { text:'Test' }, \
                                                okBtn: Button { text:'OK', properties:{name:'ok'} }, \
                                                cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \
                win = new Window (res);
                win.center();
                win.show();
                //$.writeln( win.info.name.e.text);
                $.writeln( win.buttons.okBtn.text);
                $.writeln( win.buttons.okBtn.properties.name.text);
                 // add the button's event handler, which navigates to the log in form
                win.buttons.testBtn.onClick = function()
                    alert('here');
            win.buttons.okBtn.onClick = function()
                    alert('here2');

    win.show(); should be after the onClick events....
    // Set up the navigation bar
    function buildNavbar(doc){       
            // retrieve the predefined NavBar object
            // the type defaults to "scriptui"
            var bottombar = doc.navbars.filesystem.bottom;
            // display it
            bottombar.visible = true;
            // set the height
            bottombar.height = 50;
            // add a ScriptUI display frame
            bottombar.pathPanel = bottombar.add( "panel", [5,5, 480,35], undefined);  // bounds = [left, top, right, bottom]
            // add UI components to the frame
            bottombar.pathPanel.browseField = bottombar.pathPanel.add( "statictext",[3, 3, 395, 22],"");
            bottombar.pathPanel.browseBtn = bottombar.pathPanel.add( "button",[400, 3, 465, 22],"Log In");
            bottombar.pathPanel.browseField.text = doc.thumbnail.path;
            // add the button's event handler, which navigates to the log in form
            bottombar.pathPanel.browseBtn.onClick = function(){
                res = "dialog { \
                    info: Panel { orientation: 'column', alignChildren:'right', \
                                    text: 'Log In Info', \
                                    name: Group { orientation: 'row', \
                                                    s: StaticText { text:'User ID:' }, \
                                                    e: EditText { characters: 30 } \
                                    addr: Group { orientation: 'row', \
                                                    s: StaticText { text:'Password:' }, \
                                                    e: EditText { characters: 30, properties:{noecho:true}} \
                            buttons: Group { orientation: 'row', \
                                                      testBtn: Button { text:'Test' }, \
                                                okBtn: Button { text:'OK', properties:{name:'ok'} }, \
                                                cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \
                win = new Window (res);          
                //$.writeln( win.info.name.e.text);
                $.writeln( win.buttons.okBtn.text);
                $.writeln( win.buttons.okBtn.properties.name.text);
                 // add the button's event handler, which navigates to the log in form
                win.buttons.testBtn.onClick = function(){
                    alert('here');
            win.buttons.okBtn.onClick = function(){
                win.close(0);
                    alert('here2');
             win.center();
            win.show();
    buildNavbar(app.documents[0]);

  • Problem with calling a function through onclick event in a tag

    Hi All,
    I have a text which should act as a link.
    On click of this text i need to display the table in the same page.
    this is how i want to do
    !<_ a     !st y l e='cursor pointer' h_ r  ef ='  #' !o n cl ick = " l o a dtc () "  _> display table _<  /  _a  _ >
    !<   % if i_ref = ' X' % _>
    !<   !h t m lb : t a bleVi ew id =" tv_vbak " tabl e= <  %  = it_vbak  % _ >
    !< s_c rip  t t y p e  =   "te  xt/ja  v a s c r ipt" >
    !f unct io n lo a dt c ()
    i_ref='X'.
    !<  _/ s c r i pt _>
    here am setting a flag and if that flag is set i will display the table.
    Please ignore the unewanted characters in my code. i was not able to paste the code directly.
    Thanks,
    Sandeep
    Edited by: SandeepReddy on May 25, 2010 9:22 AM

    Hi Sandeep,
    are you using javascript to get the link in the text view?
    i will tell u onething clearly.
    if you are using javascript in ur code, debugging will not wrk properly , what you need to do is add the alert in between so that you can know whether that particular code is wrking or not ok. 
    2) to call the javascript from the textview or the inputfield you have a attribute called onClientClick you need to call the function there and implement that function in javascript.
    <htmlb:textView text   = "<%= i_str %>"
                            design = "EMPHASIZED"
                            onClientClick = loadtc() />
    add ur javascript code ok
    cheers
    Bhavana
    Edited by: Bhavana Amar on May 25, 2010 10:25 AM

  • Problem with Join Queries using PHP and an Orcale Database

    Ok, I am trying to build a simple php querying tool for my oracle database and for the most part it is working however I am having a problem getting data from my join queries. If I run the following query :
    QUERY:
    SELECT lastfirst,EnteredBy,Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    Lastfirst     EnteredBy     Debit
    caiu, test      204     1
    But when I run the query correctly I get no results
    QUERY:
    SELECT sts.lastfirst,gl.EnteredBy,gl.Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    sts.lastfirst     gl.EnteredBy     gl.Debit
    and if I run the query combining the two above methods and adding a field (schoolid) that has the same name on both table I get the following result sets
    QUERY:
    SELECT lastfirst,EnteredBy,Debit,sts.schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    lastfirst     EnteredBy     Debit     sts.schoolid
    caiu, test      204     1     
    QUERY:
    SELECT lastfirst,EnteredBy,Debit,schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    NONE
    Therefore, I have to have something written incorrectly in my php code and I just can not figure it out. My entire code is pasted below please provide me with an assistance you might have to offer. I have change the odbc_connec line so I could post it to this forum. In addition, I had to phrase out the column headers there for when you write the column headers you have to use ~ instead of , as the separator and then I turn back into the correct format for sql.
    //These scripts just open help windows if somone clicks on the icon
    <script>
    function submit()
    {document.sqlform.submit();}
    </script>
    <script>
    function colwin(){
    window.open("colnames.php",null,"height=300,width=400,scrollbars=1");}
    </script>
    <script>
    function tabwin(){
    window.open("tablenames.php",null,"height=300,width=400,scrollbars=1");}
    </script>
    <script>
    function help(){
    window.open("http://www.w3schools.com/sql/default.asp",null,"height=500,width=700,scrollbars=1");}
    </script>
    <form method="post" action="<?php echo $PHP_SELF;?>" name="sqlform">
    <?php
    //Cookie to check for authorization to the site
    if($_COOKIE['cookie']=="CheckCookieForAuth")
    //These get the values of the textareas after the form has been submitted
    $sqlSELECT = $_POST["SELECT"];
    $sqlFROM = $_POST["FROM"];
    $sqlJOIN = $_POST["JOIN"];
    $sqlWHERE = $_POST["WHERE"];
    $sqlOTHER = $_POST["OTHER"];
    $sqlSELECTTYPE = $_POST["SELECTTYPE"];
    //This is the variable used to parse out my headers the user entered
    $sqlColNames = split('~',$sqlSELECT);
    //This converts the ~ separator to , so I can actually use it as part of my sql string
    $search = array('~');
    $replace = array(',');
    $mystring = $sqlSELECT;
    $sqlString = str_replace($search, $replace, $mystring);
    //These are the textareas and the drop down options that the end users has to create queries
    echo "<table border=0>";
    echo "<tr><td valign='top'>";
    echo "<B>SELECT TYPE</B> <BR><SELECT NAME=SELECTTYPE>
    <OPTION VALUE='SELECT' SELECTED>SELECT</OPTION>
    <OPTION VALUE='SELECT DISTINCT'>SELECT DISTINCT</OPTION>
    <OPTION VALUE='INSERT'>INSERT</OPTION>
    <OPTION VALUE='UPDATE'>UPDATE</OPTION>
    <OPTION VALUE='DELETE'>DELETE</OPTION>
    </SELECT>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=SELECT wrap=physical>$sqlSELECT</textarea>";
    echo "</td><td valign='top'>";
    echo "<img src='images/sqlC.jpg' width='25' height='25' onclick='colwin()'>";
    echo "</td></tr>";
    echo "<tr><td valign='top'>";
    echo "<b>FROM</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=FROM wrap=physical>$sqlFROM</textarea>";
    echo "</td><td valign='top'>";
    echo "<img src='images/sqlT.jpg' width='25' height='25' border=0 onclick='tabwin()'>";
    echo "</td></tr>";
    echo "<tr><td valign='top'>";
    echo "<b>JOIN</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=JOIN wrap=physical>$sqlJOIN</textarea>";
    echo "</td></tr>";
    echo "<tr><td valign='top'>";
    echo "<b>WHERE</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=WHERE wrap=physical>$sqlWHERE</textarea>";
    echo "</td></tr>";
    //This is where the end user would enter group by, having, order by, etc..
    echo "<tr><td valign='top'>";
    echo "<b>OTHER</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=OTHER wrap=physical>$sqlOTHER</textarea>";
    echo "</td></tr>";
    This is a run query icon and a help icon
    echo "<tr><td colspan=2 align=right>";
    echo "<img src='images/RunQuery.jpg' width='30' height='28' onclick='submit()'> <img src='images/qm.jpg' border=0 width='25' height='25' onclick='help()'>";
    echo "</td></tr></table>";
    echo "<br>";
    echo "<br>";
    //This is where I connect to my remote oracle database
         $conn=odbc_connect('ODBC_ConnectionName','USERNAME','PASSWORD');
    //This is the sql string created by the end users
         $sql="$sqlSELECTTYPE $sqlString FROM $sqlFROM $sqlJOIN $sqlWHERE $sqlOTHER";
    //This executes the connection string and the sql string
         $rs=odbc_exec($conn,$sql);
    //This will display the query or a message if the query is empty
         if($rs!=NULL){
         echo "<table border=1>";
         echo "<tr>";
    //This loops through the string array the end user enter the field name text area to get column headers
         for($i=0; $i<count($sqlColNames); $i++)
         echo "<td>";
         print_r($sqlColNames[$i]);
         echo "</td>";
         echo "</tr><tr>";
    //This actually fetchs the rows from the statement and then display the data based on the column names the end user speificed
         while (odbc_fetch_row($rs))
              for($i=0; $i<count($sqlColNames); $i++)
                   $results=odbc_result($rs,$sqlColNames[$i]);
                   echo "<td>$results</td>";
              echo "</tr>";
         odbc_close($conn);
         echo "</table>";}else{echo "Results will be displayed here";}
    echo "<br><br>";
    echo $sql;
    else
    echo "Not logged in";
    ?>
    </form>

    This looks more like a SQL question than a PHP issue. There are a couple of JOIN examples at http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10002.htm#i2066611 that might you work through the problem.

  • Imsadmin user purge problem ??

    "Hi,
    I am having a prob with purging users of one particular domain .....
    Though I can purge users of all other domains fine !!!
    I am running ims5.2 hf 2.07
    The errors I get are :
    admin-serv/logs/error
    ====================
    [22/Sep/2005:10:23:54] failure: for host host.abc.com trying to GET /msg-ms/Tasks/operation/cgi_enduser, send-cgi reports: error occurred while sending script output (IO error)
    debug of imadmin purge
    =======================
    hostA # /iplanet/ims52/ndacli/bin/imadmin user purge -D ServiceAdmin -w PASSWORD -n domainAA.com -g 0 -d DOMAINBB.com.com -l userAA -v
    [Debug]: Object = user ; task = purge
    [Debug]: default domain from Properties: domainAA.com
    [Debug]: NDAhost from Properties: hostA.domainAA.com
    [Debug]: NDAport from Properties: 8080
    [Debug]: Login: ServiceAdmin ; PASSWORD ; domainAA.com
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/auth
    [Debug]: To servlet: domain=domainAA.com&username=ServiceAdmin&password=PASSWORD&charsetenc=UTF-8
    [Debug]: cookie => JSESSIONID=hostA.domainAA.com-8%253A43322881%253A77a742bb2315863;path=/
    [Debug]: cookie => ssogrp1-nda45=hostA.domainAA.com-8%253A43322881%253A77a742bb2315863;domain=.domainAA.com;path=/
    [Debug]: In getObjTaskArgs for: user; purge
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/climap
    [Debug]: Sending to servlet: task=purge&object=user
    [Debug]: getObjTaskArgs Status: 0
    [Debug]: Number of servlets: 2
    [Debug]: Servlet Name: TaskManager
    [Debug]: Servlet args: task=PurgeUser
    [Debug]: Servlet args: objecttype=User
    [Debug]: Valid Options Array: 4
    l, true, *, true, true, user's uid, userkey,
    d, true, , false, true, DNS domain name, domainname,
    g, true, 10, false, true, grace period (days), purgegrace,
    P, false, , false, true, preview only, don't purge, preview=yes,
    [Debug]: Servlet Name: TaskManager
    [Debug]: Servlet args: task=PurgeUser
    [Debug]: Servlet args: objecttype=MailUser
    [Debug]: Servlet args: strip=yes
    [Debug]: Valid Options Array: 4
    l, true, *, true, true, user's uid, userkey,
    d, true, , false, true, DNS domain name, domainname,
    g, true, 10, false, true, grace period (days), purgegrace,
    P, false, , false, true, preview only, don't purge, preview=yes,
    [Debug]: argVal =userAA
    [Debug]: MyURLEncoder: input data = userAA
    [Debug]: servCommand =task=PurgeUser&objecttype=User&userkey=userAA
    [Debug]: argVal =DOMAINBB.com.com
    [Debug]: MyURLEncoder: input data = DOMAINBB.com.com
    [Debug]: servCommand =task=PurgeUser&objecttype=User&userkey=userAA&domainname=DOMAINBB.com%2Ecom
    [Debug]: argVal =0
    [Debug]: MyURLEncoder: input data = 0
    [Debug]: servCommand =task=PurgeUser&objecttype=User&userkey=userAA&domainname=DOMAINBB.com%2Ecom&purgegrace=0
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/TaskManager
    [Debug]: To servlet: task=PurgeUser&objecttype=User&userkey=userAA&domainname=DOMAINBB.com%2Ecom&purgegrace=0
    [Debug]: RECV: 1
    [Debug]: RECV: [email protected]: purging user...
    [Debug]: RECV: [email protected]: purge user failed:
    [Debug]: RECV: Failed: unable to parse CGI response: {<HTML><HEAD><TITLE>OK</TITLE></HEAD>
    [Debug]: RECV: <BODY><H1>OK</H1>
    [Debug]: RECV: An error has occurred.
    [Debug]: RECV: </BODY></HTML>
    [email protected]: purging user...
    [email protected]: purge user failed:
    Failed: unable to parse CGI response: {<HTML><HEAD><TITLE>OK</TITLE></HEAD>
    <BODY><H1>OK</H1>
    An error has occurred.
    </BODY></HTML>
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/logout
    [Debug]: Logout ...
    [Debug]: RECV: <html>
    [Debug]: RECV: <head>
    [Debug]: RECV: <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    [Debug]: RECV: <META HTTP-EQUIV="Content-Language" CONTENT="en">
    [Debug]: RECV: <script>
    [Debug]: RECV: if(navigator.appName.indexOf("Microsoft") != -1) {
    [Debug]: RECV: document.write('<META HTTP-EQUIV="Expires" CONTENT="Tue, 20 Jul 1971 00:00:00 GMT">');
    [Debug]: RECV: }
    [Debug]: RECV: </script>
    [Debug]: RECV: <title>iPlanet Delegated Administrator</title>
    [Debug]: RECV:
    [Debug]: RECV: <script language="JavaScript">
    [Debug]: RECV: function closeWindow() {
    [Debug]: RECV: if (window.name != "") {
    [Debug]: RECV: window.name = "";
    [Debug]: RECV: }
    [Debug]: RECV: window.close();
    [Debug]: RECV: }
    [Debug]: RECV: function backToStart() {
    [Debug]: RECV: window.top.location = "/nda/default/en/start.htm";
    [Debug]: RECV: }
    [Debug]: RECV: </script>
    [Debug]: RECV: </head>
    [Debug]: RECV:
    [Debug]: RECV: <body bgcolor="#cccccc" link="#666699" vlink="#666699" alink="#333399">
    [Debug]: RECV: <table border="0" width="100%" cellspacing="0" cellpadding="0">
    [Debug]: RECV: <tr><td align="center"><p> </p><table border="0" width="300" cellspacing="0" cellpadding="1" bgcolor="black">
    [Debug]: RECV: <tr><td><table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="white">
    [Debug]: RECV: <tr><td><table border="0" width="400" cellspacing="10" cellpadding="0">
    [Debug]: RECV: <tr><td valign="top"><img src="/nda/default/en/images/messagel.gif" width="32" height="32"></td>
    [Debug]: RECV: <td valign="top"><font face="PrimaSans BT, Verdana, sans-serif" size="-1">
    [Debug]: RECV: You are now logged out.<p>
    [Debug]: RECV: Please close your web browser now!<p>
    [Debug]: RECV: The information you have just seen remains in your Web
    [Debug]: RECV: browser's memory until you close the browser.
    [Debug]: RECV: <form>
    [Debug]: RECV: <input type=button value="Close Browser" onClick="closeWindow()">
    [Debug]: RECV: <input type=button value="Back To Start Page" onClick="backToStart()">
    [Debug]: RECV: </font></td></tr>
    [Debug]: RECV: </form>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </form>
    [Debug]: RECV: </body>
    [Debug]: RECV: </html>
    access log
    ===============
    hostA.DOMAINAA.com - - [22/Sep/2005:11:49:02 +0800] "GET /msg-ms/Tasks/operation/cgi_enduser?cmd=deleteuserfolder&object=|enduser&userdn=uid%3DServiceAdmin%2Cou%3DPeople%2Co%3DDOMAINAA.com%2Co%3Disp&userpwd=PASSWD&user=uid%3DuserAA%2Cou%3Dpeople%2Co%3DDOMAINBB.com%2Co%3Disp HTTP/1.0" 200 92 - { - }
    Any body having any clue ....."

    hi,
    I found no restriction of Internal on the mentione page so this is the buglist I found :
    List of bugs verified in iDA1.2p2
    4742853 - unable to edit mailists with name containing single quote
    4613879 - Selected focus when sorting mesage filters.
    4621763 - Domain Organization Users Cannot be Deleted/purged by CLI.
    4733829 - My Account "Set Mail Filter" clicking causes JavaScript Error
    4760708 - RFE: Prevent users from creating filters with same name
    4768794 - RFE: iDA UI should not allow customer to set Gbytes
    4800717 - "OK" and "apply" button does not function any more in particular scenario
    4806086 - RFE: iDA UI should not allow customer to set more than 2147483637 bytes
    4821819 - error when maximazing "Create a user" window
    4907306 - iDA should not display the change password page when the password is already exp
    4911038 - problem in the language of password expiration page
    4940927 - SSO: iDA shows previous user's session when invoked from Webmail
    4949005 - SSO fails between webmail and iDA depends on characters of SessionID
    4968403 - iDA causing web server to consume more CPU
    4986070 - Clicking on 'About' link shows wrong version of delegated administrator
    What is the idacli tar file for?
    With iDA 1.2p2 you will see a file called idacli-1.0-withJRE-us.sparc-sun-solaris2.6.tar which is for the 6.0 customers who never had a imadmin binary. It is not intended as an upgrade for 5.2 customers. So they should not try to install it at all.
    What it is not?
    It is not a version which will work with Web Server 6.1.
    It is tested and supported with Web Server 6.0x (6.0.1, 6.0sp5)
    It is not a version which should be used without Direct LDAP setup in the Messaging Server. (2 negatives, ok, I mean they really should be using Direct LDAP)
    It will not work with Identity Server or schema 2.
    It is not part of Messaging 6.0 (although we tested it for EXISTING customers who are going from Messaging 5.2 to 6.0 and using schema 1, we telll customers they can use the iDA they got from 5.2, and this is the one we mean.)
    Regarding the install, you should use the release notes of the iDA1.2p1
    I'm however, not sure it would solve your problem. I have not found any reference to the described issue which matchess it completely.
    And if the upgrade would solve it it's probably because something is rewritten, not fixed ... but you do not know what caused it. I don't like this myself.
    I suggest you better open a support case so it is determined what the real problem is.
    Cheers, Ben.

Maybe you are looking for