Undefined property when it does exist

Can anyone help me grasp why this isn't working? I keep
getting an 1120 error about the property, but i know that it
exists. This is the HTTPService:
<mx:HTTPService id="userupdate"
url="https://server/flex/usrchgpwd.php"
result="checkADMUsrPWD(event)" useProxy="false" method="POST"
showBusyCursor="true">
<mx:request xmlns="">
<admtype>{admType.valueOf()}</admtype><username>{adm_username.text}</username><newpwd>{adm _password.text}</newpwd>
<group>{adm_usergroup.text}</group><level>{adm_level.text}</level><status>{adm_activestatu s.text}</status>
</mx:request>
</mx:HTTPService>
This is the AS function that is erroring out:
private function checkADMUsrPWD(evt:ResultEvent):void {
if(userupdate.lastResult.changesuccess == "nodb"){
mx.controls.Alert.show("No DB connection, contact your
administrator.");
I get the error: "1120: Access of undefined property
userupdate."
I don't understand why. It's right there. And if I start
typing userupdate and then put a period, it lists the availabe
functions it will let me do. The other thing is that the script and
app actually work properly, no problems at all. So I do not
understand why it's throwing these errors.
Any thoughts?
Thanks,
Chris

Chris,
I'm having the same issue, I'm about to shoot some one!
He is my code.
Application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" >
<mx:Script>
<![CDATA[
import dto.Example;
[Bindable]
public var tempExample:Example = new Example();
tempExample._id = "test";
]]>
</mx:Script>
</mx:Application>
Class Code:
package dto
public class Example{
public var _id:String;
public function Example(){
I think it's a bug....

Similar Messages

  • Undefined property when it does exist - Need Help

    Hello everyone,
    Im having trouble finding out wuy i keep recieving :
    Line 255 1120: Access of undefined property mandala_email_click.
    The function manda_email_click exists but it keeps showing this error...
    heres the script:
    //-------button-------//
    grupoMenu.mandalaMc.hitsMc.btEmail.addEventListener(MouseEvent.CLICK, mandala_email_click);
    //--------function------//
    private function mandala_faq_click(e:MouseEvent)
    GlobalSettings.btClicado = 11;
                   if (GlobalSettings.AREA != 9)
                        Root.targets[Targets.MAIN_LOADER].trocaBg(8);
                        Root.targets[Targets.BASE].escondeScroll();
                        Root.targets[Targets.MAIN_LOADER].removeConteudoBanner("internaFaq.swf");
                        if (! GlobalSettings.areaHomeProd)
                             Root.targets[Targets.MAIN_LOADER].removeConteudoInterna("internaHome.swf");
                        GlobalSettings.AREA = 9;
                        cor = 0x8EA78F;
                        Root.targets[Targets.HOME].corBanner(cor);
                        Root.targets[Targets.BASE].escondeScroll();
                        TweenMax.to(grupoMenu.mandalaMc.guiaMc, 1, {rotation:32.7});
                        TweenMax.to(grupoMenu.mandalaMc.lineMc, 1, {rotation:32.7});
                        TweenMax.to(grupoMenu.menuMc.bt1, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt2, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt3, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt4, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt5, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt6, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt7, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt8, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt9, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt10, 0.3, {alpha:0});
                        TweenMax.to(grupoMenu.menuMc.bt11, 0.3, {alpha:1});
                        //TweenMax.to(grupoMenu.menuMc.bt9, 0.3, { alpha:0 } );
                        TweenMax.to(grupoMenu.mandalaMc, 1.2, { y:StageObj.stage.stageHeight - 3, scaleX:0, scaleY:0,alpha:0, ease:Sine.easeIn, delay:0.25 } );
                        TweenMax.to(grupoMenu.mandalaMc, 1, { y:110, scaleX:0, scaleY:0,alpha:0, ease:Sine.easeOut, delay:2 } );
                        TweenMax.to(grupoMenu.mandalaMc, 1, { alpha:1, scaleX:1, scaleY:1,ease:Back.easeOut, delay:3} );
                        GlobalSettings.NT_produto = 1;
                        trace("GlobalSettings.NT_produto: ",GlobalSettings.NT_produto);
                        Root.targets[Targets.BASE].getXMLByWord("");
                        /*if (StageObj.stage.stageWidth < 850) {
                         TweenMax.to(Root.targets[Targets.MENU].mcRodapeEsq,.8,{y:StageObj.stage.stageHeight + 200});
                         TweenMax.to(Root.targets[Targets.MENU].mcRodapeDir,.8,{y:StageObj.stage.stageHeight + 200});
                        } else {
                        TweenMax.to(Root.targets[Targets.MENU].mcRodapeEsq,.8,{y:StageObj.stage.stageHeight - 5})
                        TweenMax.to(Root.targets[Targets.MENU].mcRodapeDir,.8,{y:StageObj.stage.stageHeight - 5})
                        posicionaRodape();
                        Root.targets[Targets.BASE].analyticsTrakerAreas("contato");
    I dont think theres a problem with the function because i copied another function exaclty the same , just changed the button variable and alpha value.
    Then again, i started using AS3 a few weeks ago.
    Maybe spaces between 2 functions??
    Well i hope someone can help me i would be grateful.

    In the code you included you don't have a function called "mandala_email_click" only one called "mandala_faq_click".
    If that function is included somewhere you'll need to provide that as well, otherwise it looks like your function is just named incorrectly.

  • Verity cfsearch returns "collection does not exist" error - when collection does exist

    I have created a collection using the Coldfusion
    Administrator - and it shows up fine when displaying all the
    collections. I also populated the collection using the
    <cfindex> function - using a SQL query - and that appeared to
    work fine. It put 117 entries into the collection - and this also
    shows up in the Coldfusion Administrator collections window.
    The problem is, when I try to search the collection with the
    <cfsearch> tag, it returns an error stating "The collection
    you specified does not exists or is not registered with the
    ColdFusion Search Service."
    I can see the collection I'm trying to search exists. Is
    there anything else I need to do to get the <cfsearch>
    function to find the collection? I've tried repairing the
    collection, optimizing the collection, even deleting it and
    recreating it - nothing seems to work. I specify the
    fully-qualified path to the collection in my cfsearch, so that
    shouldn't be the problem.
    Is there some other command or function I need to run?
    Thanks!!! Pamela

    quote:
    I specify the fully-qualified path to the collection in my
    cfsearch
    Not sure if that is the problem. The path exists in the
    CFAdmin. You sould refer to the collection name in the cfsearch
    tag.
    See attached code, you can do a cfdump to see what results
    are being returned.

  • Sender File adpter --don't raise alerts when file does not exist in folder

    Hi,
    My Scenario is File --- >XI ---> SAP.
    I must archieve the file after it got polled. and iam polling for every 60 mins, if the file does not exist,it is throwing an alert like "Could not process file '.file..xml: No such file or directory '
    Is there any way i can avoid raising an alert if file does not exist in the source folder.
    we are on XI 3.0 sp23?
    Thanks
    Srini

    Hello,
    Your Subject:
    >Sender File adpter --don't raise alerts when file does not exist in folder
    is contradictory to your question.
    >if the file does not exist,it is throwing an alert like "Could not process file '.file..xml: No such file or directory '
    > Is there any way i can avoid raising an alert if file does not exist in the source folder.
    I know you want to say "Don't Raise alerts when file does not exist in folder". Correct me if I am wrong.
    Some times it happens, when we write the right thing but it means something else and this is the reason many experts have replied, "how to raise an alert". So if you remove the word "Sender File adapter" from your subject then it will be easy to understand the exact meaning.
    Regards,
    Sarvesh

  • How to update zero to a column value when record does not exist in table but should display the column value when it exists in table?

    Hello Everyone,
    How to update zero to a column value when record does not exist in table  but should display the column value when it exists in table
    Regards
    Regards Gautam S

    As per my understanding...
    You Would like to see this 
    Code:
    SELECT COALESCE(Salary,0) from Employee;
    Regards
    Shivaprasad S
    Please mark as answer if helpful
    Shiv

  • Flex marking a sample code invalid "Access of undefined property"?

    Hey,
    I used the code from this link: http://tdotblog.info/?q=node/6
    When i put it into Flex Builder 3, it has several issues with the code like "Access of undefined property FileStream" (or File).
    When I run the application, only the typical gray background appears.
    What am I doing wrong?
    Thanks, Erthy

    OK, so I used the code (btw thanks for the link, it is awesome, i already marked as much answers and helpful answers I could) and I came up with something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
         <mx:Script>
              <![CDATA[
                   import flash.filesystem.*;
                   import mx.controls.Alert;
                   public var prefsFile:File; // The preferences prefsFile
                   [Bindable] public var prefsXML:XML; // The XML data
                   public var stream:FileStream; // The FileStream object used to read and write prefsFile data.
                   public function starter():void
                   // stage.nativeWindow.addEventListener(Event.CLOSING, windowClosingHandler);
                   prefsFile = File.applicationStorageDirectory;
                   prefsFile = prefsFile.resolvePath("slovnik.xml");
                   readXML();
                   private function readXML():void
                   stream = new FileStream();
                   if (prefsFile.exists) {
                       stream.open(prefsFile, FileMode.READ);
                       processXMLData();
                   else
                       Alert.show("Nenalezeny žádné slovníky!");
                   // stage.nativeWindow.visible = true;
                   private function processXMLData():void
                   prefsXML = XML(stream.readUTFBytes(stream.bytesAvailable));
                   stream.close();
                   // var slovicko = prefsXML.slovicko.cs;
                   Alert.show("Česky je to: " + prefsXML.slovicko.@cs + "\n Anglicky je to: " + prefsXML.slovicko.@en);
                   // stage.nativeWindow.x = prefsXML.windowState.@x;
                   // stage.nativeWindow.y = prefsXML.windowState.@y;
                   // stage.nativeWindow.width = prefsXML.windowState.@width;
                   // stage.nativeWindow.height = prefsXML.windowState.@height;
                   private function writer():void
                   createXMLData();
                   writeXMLData();
                   private function createXMLData():void
                   prefsXML = <slovicka/>;
                   prefsXML.slovicko.@id = 2;
                   prefsXML.slovicko.@cs = "kočka";
                   prefsXML.slovicko.@en = "cat";
                   // prefsXML.windowState.@width = stage.nativeWindow.width;
                   // prefsXML.windowState.@height = stage.nativeWindow.height;
                   // prefsXML.windowState.@x = stage.nativeWindow.x;
                   // prefsXML.windowState.@y = stage.nativeWindow.y;
                   // prefsXML.saveDate = new Date().toString();
                   private function writeXMLData():void
                   var outputString:String = '<?xml version="1.0" encoding="utf-8"?>\n';
                   outputString += prefsXML.toXMLString();
                   outputString = outputString.replace(/\n/g, File.lineEnding);
                   stream = new FileStream();
                   stream.open(prefsFile, FileMode.WRITE);
                   stream.writeUTFBytes(outputString);
                   stream.close();
              ]]>
         </mx:Script>
         <mx:Button id="start" label="Start" width="130"
                      click="starter()"/>
        <mx:Button id="write" label="Write" width="130"
                      click="writer()" x="138"/>
    </mx:WindowedApplication>
    However, when I change the value, it overwrites the contents of the file. How can I just add one more "slovicko" element to the XML, so it would look like this:
    <?xml version="1.0" encoding="utf-8"?>
    <slovicka>
      <slovicko id="1" cs="blah" en="blah" />
      <slovicko id="2" cs="kočka" en="cat"/>
    </slovicka>
    after adding a new element, instead of just overwriting the previous content leaving only the id=2 element.
    Thanks, I failed to find it and I am sorry for my English.

  • Getting the very lovely 1120: Access of undefined property...

    Hi Guys n Gals,
    I’m getting the "1120: Access of undefined property texttwo_mc." error I've done this code before and no issue.
    What I’m doing is simple, click a button and it will go to a movie clip within a movie clip to start the label named "_go", and this error accrued. The MC I’m calling is on the beginning of the timeline.
    Thanks
    BTW for some odd reason my SWF keeps deleting it self, thats on 2 differnt PC's ones CS5 and CS4.

    Hi Ned,
    Ok ill be as detailed as possible.:
    In the main stage I have a MC with a instance name of texttwo_mc, within that i have a mocvie clip "about button" that acts like a button and its on 5 on the timeline.
    The "about button" is not viable till timeline 5 but there's a stop on timeline 1 and it goes to timeline 5 (to make itself viable) when its told to in action scripting. And there's a button on the main stage that makes it go from 1 to 5 in action scripting.
    and thats where the eror is.
    BTW the "about button" is on timeline 1..just not viable till 5.

  • FB 4.5: Flash Professinal Project - Access to undefined property

    I have a "Flash Professinal Project" in my Flash Builder. So, I have a FLA file with the scene and some symbols on it. And a pack of AS files with code.
    The trouble is with symbols in FLA file.
    For example, I have a movieclip with instance name "dlg" on my scene.
    And when I try to access this movieclip like "dlg.gotoAndStop(2)" in some code, the Flash Builder 4.5 underlines "dlg" and puts the orange question mark to the left saying "Access to undefined property dlg". Of course, FB doesn't know about existance of this movieclip. But 4.0 version didn't underline it orange.
    Project compiles ok, but some code parts looks very annoying.
    Half of my code looks like this:
    The additional uncomfortable thing is that when I use FB4 and type dlg. , it opens the autocomplete dialog assuming that "dlg" is a MovieClip by default. FB4.5 doesn't do autocomplete even after I type "dlg.gotoAndS" and press "Ctrl+Space".
    So, is there any way to get rid of this annoying orange question makrs? Maybe, there's a way to describe such instances specially for FB so it can find out their existance? Or just return the way it was in 4.0 ?

    Ok, I have finally found my issue. the "switch" syntax must have changed somewhere between Flex Builder 3 and Flash Builder 4.5.1
    This used to work in Flex Builder 3. The 'case "t", "tr"' will cause code completion to stop working, and also give the "?" warnings all over the souce. Jusr use a separate line for each "case" fixed the issue.
    This has been extremely frustrating for me, I don't have a half a day to google all over with no luck. I wound up making a copy of the project and commenting out most of the code a bit at a time to find this. Sure hope this helps someone else out there!
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                                         xmlns:s="library://ns.adobe.com/flex/spark"
                                                         xmlns:mx="library://ns.adobe.com/flex/mx"
                                                         invoke="onInvoke(event);"  >
      <fx:Script>
                        <![CDATA[
                                  private function onInvoke(invokeEvent:flash.events.InvokeEvent):void {
                                            var s:String;
                                            try {
                                                      switch ( s.toLowerCase() )
                                                                case "t", "tr":
                                                                case "trace":
                                                                          s = "trace";
                                                                          break;
                                                                case "l":
                                                                case "log":
                                                                          s = "log";
                                                                          break;
                                                                default:
                                                                          s = "?";
                                                                          break;
                                            catch ( err:Error ) {
                                                      s = "error";
                        ]]>
      </fx:Script>
      <fx:Declarations>
      </fx:Declarations>
    </s:WindowedApplication>

  • Flex Builder marking a sample code invalid "Access of undefines property"?

    Hey,
    I used the code from this link: http://tdotblog.info/?q=node/6
    When i put it into Flex Builder 3, it has several issues with the code like "Access of undefined property FileStream" (or File).
    When I run the application, only the typical gray background appears.
    What am I doing wrong?
    Thanks, Erthy

    You probably just need to have import statements for these classes in your code:
    import flash.filesystem.File;
    import flash.filesystem.FileStream;
    import flash.filesystem.FileMode;
    It looks like whoever wrote that tutorial forgot to add those. If you were typing in the code rather than pasting it in, the import statements would get automatically added, so maybe the author just didn't notice that they were necessary.
    Related Flex Builder tip:
    If you get this error for any class, it means that the compiler can't find the class definition (which usually means you're missing an import statement). The easiest way to add the import statement is to put your cursor at the end of the class name (e.g. right after the word File) and hit Ctrl-Enter (on Windows -- probably Cmd-Enter on Mac). Ctrl-Enter is the shortcut to trigger a code hint, but if you trigger it that way it will recognize the class and just add the import statement for you.

  • Flash CS3 Compiler in Strict Mode errors out 1120: Access of undefined property

    Hi,
    I am following a code example in a book and have the final fla and as files, so I know the project works when fully coded.
    This is my problem:
    In the book, it tells me I can test the movie to make sure that it is working so far. When I do that, I get the error 1120: Access of undefined property.
    The "property" is a component instance. If I take the example completed code and remove everything up to the point I am at, I receive the same errors, so I know it's not a spelling/syntax mistake.
    I have a feeling it is the Compiler in Strict Mode. But, when I change it to Standard Mode, then I get error 5001: The name of package 'com.foundastionAS3.ch12' does not reflect the location of this file. etc.
    So, in the end, I feel if I can't check my code until everything is completely finished, how do I check it as I am working?
    Can someone help?
    Thanks.
    note:: attached is a file of the compiler when it gives me multiple 1120s.

    It's funny. I checked the code from the book, it does not have it imported, but it still works. When I complete the code without the import, it works.
    When I do add the import (which is the first thing I did when the errors were thrown) while building the code, it removes that error, but the same 1120's are there. I checked the properties of the components to make sure they are runtime, and also the properties of the actionscript is runtime, so what is it?
    All of the more complex examples in the book are throwing these errors while building the code. The problem is, how do I check my code while creating it... That's why when I found this post "http://forums.adobe.com/message/2844566#2844566" I replied.

  • Load html errors undefined property File

    in the following code take 4 errors on 2 bold lines
    mdapp, Layer 'inputpage', Frame 1, Line 25 1046: Type was not found or was not a compile-time constant: File.
    mdapp, Layer 'inputpage', Frame 1, Line 26 1046: Type was not found or was not a compile-time constant: File.
    mdapp, Layer 'inputpage', Frame 1, Line 25 1120: Access of undefined property File.
    mdapp, Layer 'inputpage', Frame 1, Line 26 1120: Access of undefined property File.
    //Copy the html file outside the app directory
    var templateFile:File = File.applicationDirectory.resolvePath( "adview.html" );
    var workingFile:File = File.createTempFile();
    templateFile.copyTo( workingFile, true );
    try
        webView.loadURL( workingFile.url );
    where is my fault?

    applicationDirectory is used for files you package with your app. If you downloaded or generated the file then you might want applicationStorageDirectory.
    You also should check the .exists property before trying to do anything with a file.
    templateFile:File = File.applicationDirectory.resolvePath( "adview.html" );
    if (templateFile.exists)
        // exists, do stuff
    else
         trace('oops file does not exist');
    Never try to save to applicationDirectory either, use applicationStorageDirectory or one of the other temp cache paths in the documentation.

  • Please help me how to check a material does existed group code in system (w

    Hi all,
    Please help me...
    I have inputted quantity for  tx MC 94  but when I input them into  tx MC94, I met  a message " Structure  not yet maintained for  this conbination characterstics". Step by step to show a error message as below:
    Step 1: Launch MC 94
    step 2: Enter Planning
    Step 3: Enter  Prod.Code. Material (ex: enter material code :0101010260008, this code is existed  Prod.Code )
    Step 4: Click on "Inactive Version " button
    ==> A error message is showed.
    Please help me how to check a material does existed group code in system (which table to  check  it)?
    How to record the message" Structure  not yet maintained for  this conbination characterstics" to catch up it in my program?
    Thank in advance.

    Karenloria,
    1. Check in MC8C, which Infostructure is used for Planning type "Planning" or the one you are entering in the intial screen of MC94.
    2. Using transaction MC63 for the infostructure identified in step 1, check the planning hierarchy maintained. If this product is not maintined maintain using MC62.
    You can also check using SE16 transction the current infostructe records(Plan) for the table name = infostructure identified in step 1.
    Regards,
    Prasobh

  • FCPX hangs on loading event in boot up, but when it does boot it runs very slowly.

    I'm having a problem with FCP 10.0.9
    When I try to open the program it gets hung up on the opening logo at loading event. I get a message that FCP is not responding in the force quit menu,  but after around 6 hours FCPX opens up, but runs very slowly. I can see all of my projects and everything appears to be intact.
    I'd like for FCPX to run smoothly again so I am looking for advice on how to fix it.
    Here is some pertinent information.
    I'm working on an 2.93 GHz intel core 7 iMac / 16GB memory / ATI Radeon HD 5750 1024 MB / OS 10.7.5
    Everything is on an external 12tb Raid drive that has 5.7 TB free and is connected via Firewire 800.
    The footage has been going into FCP is Arri Alexa footage that has been transcoded using Devinci resolve and proxies were created for all the footage within fcp.
    My event folder is around 600 gb and the transcoded footage that has been imported into FCP is around 6TB
    I've been working for about 3 weeks and have everything broken into 4 projects within one event and everything was working smoothly until yesterday.
    I have no compound clips, but all of my imported footage has been synced, multicam-ed and organized by keyword collections.
    I've tried loading the even backup to no avail (and foolishly I did not have backups stored anywhere else)
    I've tried trashing preferences.
    I've tried reinstalling the program.
    I've tried hiding events and projects with Event Manager X.
    I've tried running diagnostics using the digital rebellion pro maintenance tools Corrupt Clip Finder, Project repair, and Quick Fix but everything came back clean.
    One person at Apple technical support suggested I move the footage out of my event folder In pieces to see if there was a corrupt clip. First I removed the proxies and then the original media and then everything else (including all render data) until the only thing in the even folder was the event itself, but still FCP hung up on boot up.
    Another apple technical support person suggested I should have optimized my media (which I did not do) but after getting FCP to boot up I let it optimize all my media overnight and this has not had any significant effect.
    My console displays lots of error messages end with "Too many SQL Variables"
    Another error message I am getting in console is: 
    Class CMIOGraphService is implemented in both /System/Library/Frameworks/CoreMediaIO.framework/Versions/A/CoreMediaIO and /Applications/Final Cut Pro.app/Contents/Frameworks/CoreMediaLion/CoreMediaIO.framework/Versions/Curren t/CoreMediaIO. One of the two will be used. Which one is undefined.
    When I hide the event but keep the projects in their proper place FCP boots up quickly and my projects are all there but none of the footage appears since it is all within my event.
    One thing I am reluctant to try but may end up doing if I cannot find the correct answer from this internet community is Export and XML and use Xto7 to try to open it up in FCP7 and finish the project there. This feels like something that is going to cause me problems down the road, but I'm unsure.
    As is almost always the case, I'm under an impossibly tight deadline so any advice would be much appreciated.
    Thanks!
    Brody

    Quite the same problem here: FCP X (10.0.9) crashed while quitting, now it's always hanging up (opening logo freezes while displaying "loading .... event"). The Console says: "SQLite error code:1, 'too many SQL variables'".
    The difference maybe is that my event isn't that big. 350 GB, including the original and transcoded media. The fcpevent file itself is about 340 MB. Unfortunately (my fault!) I didn't backup any of the .fcpevent files.
    Is there any possibility to repair the .fcpevent file? I tested the repair tool by digital rebellion, but still no success. Are there any other ideas?
    Thanks!
    Ronja

  • I am getting an error while coding between CS5 and Flash CC specifically: Access of undefined property instrument_txt. I am using a book that is made for CS5. Is there a current book or resources for Actionscript 3.0 and Flash CC?

    Scene 1, Layer 'actions', Frame 1, Line 47, Column 2
    1120: Access of undefined property instrument_txt.
    this is my problem. any ideas. thanks

    I did try this and nothing happened, same error codes. The code works fine from CS5 and CS6 Flash versions. The animation runs well, the text displays where it should in the instrument_txt frame. It is when I try this in Flash CC that it creates the code error. here was an error that came up regarding text problems, something with FLT text converted to another text (I am not sure of the name of the text-type and the "FLT" I am not sure of either).
    thanks

  • Set a dynamic default property when a page is created?

    Is there a way to set a default property that is dynamic for a page when it is created? For example, i want to capture a user id from our system and store it in an "author" property when the page is first created. This value can be changed to a different user by the author but in case they don't set it i want to have it default on page creation.
    I guess a better question would be, is there somewhere i can put code so that it will be executed when a page is created?
    I considered writing a custom widget and putting this in page properties, but that won't actually run unless page properties has been opened.
    Thanks

    For anyone in the future, here is how i implemented the event handler -
    @Component
    public class PageCreationObservation implements EventListener {
        Logger log = LoggerFactory.getLogger(this.getClass());
        private Session adminSession;
        @Reference
        SlingRepository repository;
        @Activate
        public void activate(ComponentContext context) throws Exception {
            log.info("Activating PageCreationObservation");
            try {
                String[] nodetypes = {"cq:Page"};
                adminSession = repository.loginAdministrative(null);
                adminSession.getWorkspace().getObservationManager().addEventListener(
                    this, //handler
                    Event.NODE_ADDED, //binary combination of event types
                    "/content/appname", //path
                    true, //is Deep?
                    null, //uuids filter
                    nodetypes, //nodetypes filter
                    false
            } catch (RepositoryException e) {
                log.error("Unable to register session",e);
                throw new Exception(e);
        @Deactivate
        public void deactivate(){
            if (adminSession != null) {
                adminSession.logout();
        public void onEvent(EventIterator eventIterator) {
            try {
                while (eventIterator.hasNext()) {
                    Event newEvent = eventIterator.nextEvent();
                    log.info("something has been added : {}", newEvent.getPath());
                    //Check if node exists and it is a content node of the newly created page
                    if (adminSession.nodeExists(newEvent.getPath())
                            && adminSession.getNode(newEvent.getPath()).getProperty("jcr:primaryType").getString().equals("cq:PageContent")) {
                        Node contentNode = adminSession.getNode(newEvent.getPath());
                        if (contentNode.getProperty("jcr:createdBy") != null) {
                            contentNode.setProperty("author", contentNode.getProperty("jcr:createdBy").getString());
                adminSession.save();
            } catch(Exception e){
                log.error("Error while treating page creation events",e);

Maybe you are looking for

  • How to call a subroutine in a script ?

    Hi ,   How to call a subroutine in a script ? bye, Satya.

  • ITunes locking up with Video Files

    I have a 30gig iPod video. I have been buying some rather large Videos, I get them into iTunes no problem, but when I try to click and drag them over to my iPod in the source pane my PC locks up and I need to reboot. I also tried doing an automatic u

  • Switch fremwork for EA-HR Globle status of off.

    hi, I am working for ESS/MSS implementation project. while implementing BADI "HRASR00PROCESS_REF_NUM" we are getting message HRASR_DEF active badi implemention does not exist. After analysis of issue found that in SFW1 EA-HR is active but Global stat

  • Special offer - Photoshop and Lightroom 5

    Hi I am currently a part of the Photoshop CC, and pays approx. 50USD/month. There is a special offer until 8 Dec. were you can have Lightroom included for only 17USD... Is it possible tot change the licence and save some money ? Best regards Lars

  • Can't create spool file

    Hi, I've problems in creating spool file. I've some PL-SQL scripts, running monthly with sqlplus on Windows 2000, that have always generated spool file using the statements "spool filename.log". Two days ago, I run this scripts and I noticed that the