Group Selected Items [Javascript / CS3]

This seems like it'd be an extremely easy thing to do, but I'm unable to figure it out after searching forums, google, and the scripting documentation. I'm trying to just group whatever items are selected when I run the script. Some of the things I've tried are:
var document = app.activeDocument;
var selection = document.selection;
//this doesn't work, I get 'invalid parameter'
//for the groups.add() function.
var group = document.groups.add(selection);
//same here, I get invalid parameter on groups.add()
var itemArray = new Array;
for (var i in selection) {
    itemArray.push(i);
var group = document.groups.add(itemArray);
//also doesn't work. Debugging shows that the itemArray.push()
//is never reached, so the isPrototypeOf isn't working like I expect.
var itemArray = new Array;
for (var i in selection) {
    if (i.prototype.isPrototypeOf(PageItem)) {
        itemArray.push(i);
var group = document.groups.add(itemArray);
Do I just have something fundamentally wrong with how I'm trying to approach this? I'm new to Javascript, I've worked a lot with Java (Don't worry, I know they're completely unrelated), but I've got a few other scripts working, this particular issue I can't seem to figure out, though.
Thoughts?
Thanks!

groups.add indeed only accepts an array of page items.
//same here, I get invalid parameter on groups.add()
var itemArray = new Array;
for (var i in selection) {
    itemArray.push(i);
var group = document.groups.add(itemArray);
//also doesn't work. Debugging shows that the itemArray.push()
Your "for" loop syntax is wrong. Use this:
for (var i=0; i<selection.length; i++)
   itemArray.push (selection[i]);
That ought to make it work, methinks.
I guess you don't have to explicitly check if your selection are page items -- or perhaps you only have to check the very first item. It's impossible to select both a text range and page items

Similar Messages

  • How to disable a lead selected item in a radio button group ?

    Hi,
    I have a radio button group and there are entries to create radio buttons dynamically. means there is only one radio button group in the UI design and in runtime I will be having two radio buttons (For ex: Yes and No ) . Now If I want to disable either Yes or No radio button, I am unable to do so. because If I disable the radio button group it disables both.  So, I can have lead selected item for ex: Yes which I want to disable. I want to know specifically how this Yes button to be disabled by taking lead selected index item.
    Please help.
    Thanks
    Praveen

    Try setting the radio button value of the lead selected button to abap_false/space.

  • Javascript help to copy selected items from one list to another list on same site

    Hello,
    So I have a request that I am not sure how to handle. I have created a page with a list view webpart that displays all the items from one list.
    The user is then supposed to select off multiple list items and click on a button (most likely a ribbon button) that will take the selected items and copy them to another list on the same SharePoint site.
    I would like to do this with JavaScript, but have only found an example that copies library items to another library.

    Hi KansaiKel,
    According to your description, my understanding is that you want to copy selected list items to another list.
    I suggest you can use JavaScript Client Object Model to achieve it.
    Here is a code snippet for your reference:
    <script type="text/javascript">
    var context = SP.ClientContext.get_current();
    var siteUrl = 'http://sp2013sps/sites/test';
    var clientContext = new SP.ClientContext(siteUrl);
    var web = context.get_web();
    context.load(web);
    var sourceId = SP.ListOperation.Selection.getSelectedList();
    var source = web.get_lists().getById(sourceId);
    var oList = context.get_web().get_lists().getByTitle('Copy');
    context.load(oList);
    var selectedItems = SP.ListOperation.Selection.getSelectedItems(context);
    alert('debut');
    for(var i in selectedItems)
    var currentItem = source.getItemById(selectedItems[i].id);
    context.load(currentItem);
    context.executeQueryAsync(Function.createDelegate(this,test),Function.createDelegate(this,error));
    function test(sender, args){
    var itemCreateInfo = new SP.ListItemCreationInformation();
    var oListItem = oList.addItem(itemCreateInfo);
    oListItem.set_item('Title', currentItem.get_item('Title'));
    oListItem.update();
    oList.update();
    alert('done');
    function error(sender, args){ alert('error');}""
    </script>
    Here is a detailed article for your reference:
    Complete basic operations using JavaScript library code in SharePoint
    Best Regards
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Zhengyu Guo
    TechNet Community Support

  • Javascript, IllustratorCS3, select items and change layers

    Hi
    I am trying to select an object defined with fill color Cyan and move that object to another layer. Is there any way to do this with JavaScript? Could you please help.
    PS: I want script to select that object, not the user.
    Thanks
    Sel KAHRAMAN

    Thanks for your reply Yann,
    I already know how to change the texts, the problem is that the texts I would like to change:
    To select old purchase orders or templates, choose
    Then select items and add them to the shopping cart 
    Are not in the list of attributes/texts...
    Where can this text be located?
    I find it hard to believe that it is hardcoded...

  • CheckBox Group Get Selected Items

    Hi, I have a problem with a CheckBox Group.
    I have different items in the CheckBox Group, and I get the items that are selected.
    When I do the checkboxgroup.getselected () returns the selected items, but I do not know how to get the values separately.
    I tried to do:
    ArrayList array = new ArrayList ();
    array. add (checkboxgroup.getSelected ());
    but in the array.get (0) add all the values. And I need:
    array.get (0) -> first value selected checkboxgroup
    array.get (1) -> second value selected checkboxgroup
    array.get (2) -> third value selected checkboxgroup
    Thank's !
    Edited by: henrynxd_08 on Jul 16, 2009 4:55 AM

    Never mind..I got it.
    it as simple as that:
    Alert.show (lst.selectedItem.fieldname);
    ;)

  • Just moving from PC to Mac. How do you select a group of items. On the PC it was shift right click

    Just moving from PC to Mac. How do you select a group of items. On the PC it was shift right click

    In list or column view, click the item at one end of the range and then shift-click the item at the other end.
    In icon view, click on an empty part of the window and drag to select them.
    (113533)

  • How to group Page Items with fieldset and legend HTML tags ?

    I have 7 Page Items (i.e. select list, input text....) defined in Side Bar Region of my Page Zero,
    for clarity I would like to group these items as follows:
    1) <fieldset>
    <legend>Costs</legend>
    <input ..... item1 >
    <input .... item2 >
    <input..... item3 >
    </fieldset>
    1) <fieldset>
    <legend>Technical Attributes</legend>
    <input ..... item4 >
    <input .... item5 >
    <input..... item6 >
    <input..... item7 >
    </fieldset>
    I appreciate if you can tip me  with  a URL link or codes examples i.e. javascript, Side Bar template #BODY# customization.
    Thanks for your tips.

    What if you need to access more than one data source?
              <sql:query var="myQuery" dataSource="myDataSource">
              </sql:query>
              <sql:query var="myOtherQuery" dataSource="myOtherDataSource">
              </sql:query>
              If you specify one data source as the default, how do you access the other
              one?
              -- Craig
              "thanh nguyen" <[email protected]> wrote in message
              news:3fa18529$[email protected]..
              > I believe you can set up a default datasource for the application context
              in the web.xml and weblogic.xml. That way, on your JSP, you will not need to
              set the datasource. The connection pool will handle all of that for you.
              >
              > 1. modified weblogic.xml
              > <reference-descriptor>
              > <resource-description>
              > <res-ref-name>jdbc/hr</res-ref-name>
              > <jndi-name>jdbc/hr</jndi-name>
              > </resource-description>
              > </reference-descriptor>
              > 2. modified web.xml
              > <context-param>
              > <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
              > <param-value>jdbc/hr</param-value>
              > </context-param>
              >
              > <resource-ref>
              > <res-ref-name>jdbc/hr</res-ref-name>
              > <res-type>javax.sql.DataSource</res-type>
              > <res-auth>CONTAINER</res-auth>
              > </resource-ref>
              > 3. redeploy app
              

  • Headers in Dropdown lists? (Non-selectable items)

    Does any one know how to make headers in dropdown lists? I have 2 groups of items I want to add a header for each in the dropdown list. The headers just have to be non selectable.
    thanks,

    Hi Kris,
    In Designer 7.1, I created a DropDown List which includes Headers and sub categories under these headers, where the Headers are not selectable. When I built my DropDownList I then assigned Values to each item in the list, which I've put in brackets for you:
    HEADER ONE (10)
    Item A (1)
    Item B (2)
    Item C (3)
    HEADER TWO (11)
    Item X (4)
    Item Y (5)
    Item Z (6)
    This is the JavaScript I wrote on the Exit event:
    if (DropDownList.rawValue > 10) {
    DropDownList.rawValue = "";
    Hopes this works for you.

  • How to get textbox text inside Repeater based on specific row dropdownlist selection using JavaScript

    Hi All,
    I have dropdownlist and textbox controls inside repeater control. Suppose when i select specific dropdownlist i want get the value of selected item and mean while i want to get the textbox text which in the same row.
    <script type="text/javascript">
    var ddlType;
    function ddl(ddl) {
    ddlType = ddl.value;
    alert(ddlType);
    </script>
    <asp:Repeater ID="RepterDetails" runat="server"
    onitemdatabound="RepterDetails_ItemDataBound"
    onitemcommand="RepterDetails_ItemCommand" >
    <ItemTemplate>
    <tr>
    <td>
    <asp:DropDownList ID="ddlTypeName" runat="server" onchange="ddl(this)"></asp:DropDownList>
    </td>
    <td>
    <asp:TextBox ID="txtCode" runat="server" Text='<%#Eval("otaRoomTypeCode") %>' />
    </td>
    </tr>
    </ItemTemplate>
    </asp:Repeater>
    Using the javascript i got the selected dropdownlist selected value, how to get the textbox text which is in the same row.
    Please give me advice and please find the repeater control screenshot.
    Thanking You, Nagendra.

    This forum if for C# issues, please move your post to asp.net forum:  http://forums.asp.net/
    Thanks
    Fouad Roumieh

  • Apex 3.2 group select list

    Hi,
    I just want share this if you are still in older version of Apex and you use jQuery.
    I did made "plugin" for grouped select list
    See sample here
    http://actionet.homelinux.net/htmldb/f?p=100:86
    Plugin source
    ;(function(){
    jQuery.fn.htmldbLovOptGrp=function(o){
    var t=jQuery(this);
    o=jQuery.extend({
      sessionValue:t.val(),
      nullShow:false,
      nullValue:'%null%',
      nullDisplay:'%',
      lovProcess:undefined,
      lovGrpLabel:'GRP',
      lovDisValue:'DIS',
      lovRetValue:'RET',
      loadingTxt:'Loading ...',
      loadingCss:{'width':'80px'}
    },o);
    return lCreSelect(t,o);
    jQuery.htmldbAjax=jQuery.fn.htmldbAjax=function(opt){
    jQuery.ajaxSetup({
      url:'wwv_flow.show',
      dataType:'HTML',
      traditional:true,
      cache:false,
      type:'POST',
      data:{
       p_flow_id:jQuery('#pFlowId').val(),
       p_flow_step_id:jQuery('#pFlowStepId').val(),
       p_instance:jQuery('#pInstance').val()
    return jQuery.ajax(opt);
    jQuery.htmldbJSON=jQuery.fn.htmldbJSON=function(opt,callfn){
    return jQuery.htmldbAjax({dataType:'json',data:opt,success:callfn});
    function lCreSelect(t,o,j){
    t.empty().hide().parent().append(jQuery('<div/>').html(o.loadingTxt).addClass('ui-autocomplete-loading').css(o.loadingCss));
    jQuery.htmldbJSON(jQuery.extend(j,{p_request:'APPLICATION_PROCESS='+o.lovProcess}),function(jd){
      if(o.nullShow){lAppendOpt(t,null,o.nullDisplay,o.nullValue);}
      jQuery.each(jd.row,function(i,d){lAppendOpt(t,d[o.lovGrpLabel],d[o.lovDisValue],d[o.lovRetValue]);});
      t.val(o.sessionValue).trigger('change').show().parent().find('div.ui-autocomplete-loading').remove();
      return t;
    function lAppendOpt(t,l,d,r){
    var o=lCreateOpt(d,r);
    if(l){
      var g=lGetOptGrp(t,l);
      if(g){g.append(o);}
      else{t.append(lCreOptGrp(l).append(o));}
    }else{t.append(o);}return true;
    function lExists(p){return(p.length==1);}
    function lCreateOpt(d,r){return jQuery('<option/>').val(r).html(d);}
    function lCreOptGrp(l){return jQuery('<optgroup/>').attr({'label':l});}
    function lGetOptGrp(t,l){var g=t.find('optgroup[label="'+l+'"]');if(lExists(g)){return g;}else{return false;}}
    })();Copy code and save it to file e.g called jquery.htmldbQuery.js and upload it to workspace Static Files.
    Create new page and blank HTML region.
    Create select list with LOV query
    SELECT null d, null r FROM dualCreate On Demand application process called GET_GRP_LOV like
    DECLARE
    l_sql VARCHAR2(32700);
    BEGIN
    l_sql :='
      SELECT mgr AS grp,
       ename AS dis,
       empno AS ret
      FROM emp
    APEX_UTIL.JSON_FROM_SQL(l_sql);
    END;Place to page HTML header
    <script type="text/javascript" src="#WORKSPACE_IMAGES#jquery.htmldbQuery.js"></script>
    <script type="text/javascript">
    $(function(){
    $('#Px_MY_SELECT').htmldbLovOptGrp({lovProcess:'GET_GRP_LOV'});
    </script>Where Px_MY_SELECT is your select list name.
    As I did say this need you also load jQuery. Apex 4 have jQuery , but if you are on later version see e.g. this blog post
    http://www.oracleapplicationexpress.com/tutorials/66
    I hope this helps someone
    Br,Jari
    Edited by: jarola on Aug 17, 2010 8:44 PM
    Same thing seems to be work also with Apex 4.0
    http://apex.oracle.com/pls/otn/f?p=40323:50
    But if I have understand correctly Apex 4.0 have some build in or better thing to get same result
    Edited by: jarola on Aug 17, 2010 10:54 PM
    copy&paste mistake corrected
    Edited by: jarola on Aug 18, 2010 12:57 AM
    I hope editing post all the time is ok =).
    I have not test this on any other browser than Fire Fox, so all comments are welcome.
    Also I have try create similar plugin for cascading lov. Sample here
    http://actionet.homelinux.net/htmldb/f?p=100:85
    Maybe there is this kind plugins already for Apex 3.x, I have not just seen.
    Also I'm beginner with jQuery so all help and comments is needed
    Edited by: jarola on Aug 18, 2010 2:01 AM
    mistake in guide corrected.

    Hi Matt,
    which version of APEX are you currently on?
    With ApexLib Framework you can have cascading select lists in normal forms, but not in a Report or Tabular Form. Also refreshing a Report when changing a select list doesn't work out of the box. You would need to add some javascript. But i think this isn't what you wanted.
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    BuilderPlugin: http://builderplugin.oracleapex.info
    Work: http://www.click-click.at

  • Group form items to handle  large number of input items

    Hi,
    I have a form region with about 50 items. They are to many too display all at the same time. What I would like to do is to group these items into three separate groups. Also I would like to place "flip" button at the top that user can press and can display one of the three item groups - one at a time.
    Is the hiding and displaying of items in the described way possible without extensive Javascript coding?
    Regards, Tamas

    Hi,
    1) http://shijesh.wordpress.com/2010/04/04/jquery-tab-in-apex-3/
    2) Re: Creating a tab region within a page in APEX
    Regards,
    Shijesh

  • Handle selected items in a panel

    Hello,
    Is it possible to handle multiple selected items from an Indesign panel using javascript in CS4?
    Any help would be much appreciated.
    Thanks,
    Kesav.

    With one possible exception (libraries, I vaguely remember), this is not possible. Dirk Becker has a very useful plugin that expands the JS so that you can see what's selected in several InDesign panels. An alternative is to do a scriptUI interface and include in it a list box in which you list some panel's contents, so that your script can act on whatever is selected in there.
    For an example, see here: http://www.kahrel.plus.com/indesign/pdf_individuals.html
    Peter

  • SHOW ALL / HIDE ALL BUTTONS produce error in chm but not in "View Selected Item"

    My SHOW ALL and HIDE ALL buttons work in the View Selected
    Item mode. However, the compiled version generates an error tag:
    Line: 72
    Char: 1
    Error: Object expected
    Code: 0
    URL:
    mk:@MSITSTORE:C\Documents%20and%20Settings\glenn_michaels\RoboHelp%206.0\TCA\!SSL!
    In short, the the compiled chm is located in the SSL. I tried
    adding showhide.js and ehlpDhtm.js to the SSL folder, but that
    didn't make a difference. What is missing? How do I fix this?
    Many thanks in advance...
    glennito

    Mr. Grainge,
    I've tried to follow your instructions to the letter, but I'm
    not having any luck.
    1) I copied the showhide.js to
    a) RoboHelp 6.0 > Project Folder
    b) RoboHelp 6.0 > Project Folder > SSL
    c) RoboHelp 6.0 > Project Folder > SSL >
    MicroSoft_HTML_Help
    2) I pasted btnhideall.gif, btnshowall.gif, printerblue.gif
    into
    a) RoboHelp 6.0 > Project Folder > SSL
    b) they are also listed in RoboHelp 6.0 > Project Folder
    3)The Project Manager > Baggage File originally displayed
    a
    a) Project (Name) folder
    b) ehelp.xml
    c) RoboHHre.Ing
    I opened the Baggage File > Project (Name) folder,
    selected New Baggage File, and added, respectively:
    i. btnhideall.gif
    ii. btnshowall.gif
    iii. ehlpDhtm.js
    iv. printerblue.gif
    v. printerred.gif
    vi. showhide.js
    vii. TCA.fpj
    vii. root.fpj
    4) I also opened rhbag.apj in Notepad. It shows
    a) ehelp.xml and RoboHHRE.Ing accompanied by
    <usercreated>false</usercreated> tags
    b) the remaining baggage files are accomanied by
    <usercreated>true</usercreated> tags
    5) Finally, I used Notepad to display two topic files in
    which the error message identified a Line: XX. In one case the line
    # is 42, in another, 19. In both cases, when I counted lines,
    starting with <body>, I ended up on:
    onClick="JavaScript:hideEm()"
    However, I am none the wiser for my effort and don't know
    what (5) might be telling me.
    6) The only thing I can think of is that the compiled chm
    file is two levels away from the Project Name directory that holds
    all the files. The files live in Robohelp 6.0 > Project Name
    while the compiled help is found in Robohelp 6.0 > Project Name
    > SSL! > MicroSoft_HTML_Help > Project Name.chm.
    Should I be adjusting the Relative Path within the topics?
    Many thanks for your attention and assistance.
    glenn

  • *General item Category Group*      vs    *Item Category Group*

    Hi,
    What's the difference for the General item Category Group and Item Category Group in the material master?
    Thanks.

    Hi,
    General item category grp is used in the sales processes like BOM, where we have higher item category and the default item
    categories.  
    General item category grp would refer to the higher level item category and item category grp would refer to the default item category
    General Item category Group is an extension item category group. Example: if one select item catagory group as NORM, but under item category group, NORM can further be classified as Service item, packagaing item or Normal
    item using "general item category group". 
    Also, General item category group is maintained at client level, this field can be maintain from Basic Data View of Material Master. Thus in case item category group is missing, then general item category group is used for item category determination.
    Item category group determines how a material is processed in the sales order. When processing sales and distribution
    documents, the system uses the item category group to determine the item category and proposes it in the respective document. Item category group is defined in the Sales Org View 2 of Material Master Record.  
    Example, in the standard SAP System, the item category group NORM is defined for materials kept in stock and the group DIEN for services and non-stock material
    Best Regards,
    Amit.
    rewards, if helpful.

  • Hiding built-in Menu items in CS3 (JS)

    Hi all,
    Is there any option through javascript to hide ie. disable built-in menu items in CS3. Here our requirement is to hide the menu items like Hide Attributes, Hide Comments, Hide Processing Instruction in the XML palette. Have to disable in all the places.
    Thanks
    Vaasu

    Thanks,
    This helps a bit.
    What do I use for "SomeScriptMenuItem".
    I have tried...
    var myScriptMenuItem3 = myFileMenu.menuItems.add(myScriptAction3, LocationOptions.AFTER, "User...");
    var myScriptMenuItem3 = myFileMenu.menuItems.add(myScriptAction3, LocationOptions.AFTER, User);
    var myScriptMenuItem3 = myFileMenu.menuItems.add(myScriptAction3, LocationOptions.AFTER, 24);
    I want my menu item to appear after "User..." in the file menu.
    Thanks

Maybe you are looking for

  • I accidentally hid my devices tab on iTunes?

    My Computer Recognizes my IPod Touch, But I accidentally clicked "hide" on the devices tab in Itunes. I'm not sure itunes recognizes my ipod or if i just cant see the devices tab. How do I get the devices tab to show up again? PLEASE HELP!

  • Some Help Please. Shooting Game

    Right the basic story is that im making this game where animals cross the screen and you shoot them (aka click the mouse on them) and get points. Im having a couple of problems. I wanted to have the gunshot noise whenever i clicked ANYWHERE so i put

  • HT201272 how to change a rescue email

    im trying to change my apple id but it is saying that i cannot make my new id because it is my rescue email.  i have added several different emails but i do not know how to change any of them to the "rescue email"

  • How to change passcode when you dont know it

    Hi there i have changed my passcode but you know when you use fingerprint recognition at all times and than you battery died on you when you started up you have to put passcode in and that is where my problem began. Can somebody tell me how to reset

  • Comparison between Parallel and VMWare

    I am wondering which is better to run Window XP: Parallel or VMWare?