www.webdeveloper.com
Results 1 to 3 of 3

Thread: javascript issue

  1. #1
    Join Date
    Jun 2009
    Posts
    96

    javascript issue

    I have following javascript file , which clears the field when "clear" button is selected for the xml file which is shown in the code below javascript code.
    What does region mean in the javascript file ? There is no field by the name region in xml file. Is that some special syntax word in javascript which can take care of any field name for that place in hierarchy ? If not, then why do I not get error when this is region word and field name in the xml file dont match ?


    Code:
    mb_makeReadOnly("/root/"+region+"/banner_slides/en_image");
    	mb_makeReadOnly("/root/"+region+"/banner_slides/fr_image");
    	IWEventRegistry.addItemHandler("/root/"+region+"/banner_slides/en_image", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/banner_slides/fr_image", "onCallout", clearMediaBinFields);
            IWEventRegistry.addItemHandler("/root/"+region+"/en_image", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/fr_image", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/image", "onCallout", clearMediaBinFields); //For Search Component
    
    	mb_makeReadOnly("/root/"+region+"/block/en_image");
    	mb_makeReadOnly("/root/"+region+"/block/fr_image");
    	IWEventRegistry.addItemHandler("/root/"+region+"/block/en_image", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/block/fr_image", "onCallout", clearMediaBinFields);
    
    	mb_makeReadOnly("/root/"+region+"/promo/block/en_image");
    	mb_makeReadOnly("/root/"+region+"/promo/block/fr_image");
    	IWEventRegistry.addItemHandler("/root/"+region+"/promo/block/en_image", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/promo/block/fr_image", "onCallout", clearMediaBinFields);
    
    	mb_makeReadOnly("/root/"+region+"/nested/block/en_image");
    	mb_makeReadOnly("/root/"+region+"/nested/block/fr_image");
    	IWEventRegistry.addItemHandler("/root/"+region+"/nested/block/en_image", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/nested/block/fr_image", "onCallout", clearMediaBinFields);
    
    	mb_makeReadOnly("/root/"+region+"/en_image_small");
    	mb_makeReadOnly("/root/"+region+"/fr_image_small");
    	mb_makeReadOnly("/root/"+region+"/en_image_large");
    	mb_makeReadOnly("/root/"+region+"/fr_image_large");
    	IWEventRegistry.addItemHandler("/root/"+region+"/en_image_small", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/fr_image_small", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/en_image_large", "onCallout", clearMediaBinFields);
    	IWEventRegistry.addItemHandler("/root/"+region+"/fr_image_large", "onCallout", clearMediaBinFields);
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE datacapture SYSTEM "datacapture6.0.dtd">
    <data-capture-requirements type="content" name="Index">
    	<ruleset name="Index">
    		<root-container name="root" location="root">
    	<!-- Start/End Date Metadata -->
    	<!-- DEFAULT -->
    			<container name="default" location="default" combination="and">
    				<label>Image</label>
    				<item name="en_image_id" pathid="en_image_id">
    					<hidden />
    				</item>
    				<item name="fr_image_id" pathid="fr_image_id">
    					<hidden />
    				</item>
    				<item name="en_image" pathid="en_image" rowcontinue="t">
    					<label>Image English</label>
    					<description>English Image</description>
    					<text required="f" size="30">
    						<callout label="Clear"/>
    					</text>
    				</item>
    				<dialog type="mediabin" label="MediaBin" rowcontinue="t">
    					<dialog-param name="asset-id">
    						<dialog-input>
    							<field-ref name="en_image_id"/>
    						</dialog-input>
    						<dialog-output>
    							<field-ref name="en_image_id"/>
    						</dialog-output>
    					</dialog-param>
    					<dialog-param name="path">
    						<dialog-input>
    							<field-ref name="en_image"/>
    						</dialog-input>
    						<dialog-output>
    							<field-ref name="en_image"/>
    						</dialog-output>
    					</dialog-param>
    					<dialog-param name="label">
    						<dialog-output>
    							<field-ref name="en_image_alt"/>
    						</dialog-output>
    					</dialog-param>
    				</dialog>
    				<item name="fr_image" pathid="fr_image" rowcontinue="t">
    					<label>Image French</label>
    					<description>French Image</description>
    					<text required="f" size="30">
    						<callout label="Clear"/>
    					</text>
    				</item>
    				<dialog type="mediabin" label="MediaBin" rowcontinue="f">
    					<dialog-param name="asset-id">
    						<dialog-input>
    							<field-ref name="fr_image_id"/>
    						</dialog-input>
    						<dialog-output>
    							<field-ref name="fr_image_id"/>
    						</dialog-output>
    					</dialog-param>
    					<dialog-param name="path">
    						<dialog-input>
    							<field-ref name="fr_image"/>
    						</dialog-input>
    						<dialog-output>
    							<field-ref name="fr_image"/>
    						</dialog-output>
    					</dialog-param>
    					<dialog-param name="label">
    						<dialog-output>
    							<field-ref name="fr_image_alt"/>
    						</dialog-output>
    					</dialog-param>
    				</dialog>
    				<item name="en_image_alt" pathid="en_image_alt" rowcontinue="t">
    					<label>English image ALT</label>
    					<description>English ALT tag to the Image</description>
    					<text size="40" required="f" />
    				</item>
    				<item name="fr_image_alt" pathid="fr_image_alt">
    					<label>French image ALT</label>
    					<description>French ALT tag to the Image</description>
    					<text size="40" required="f" />
    				</item>
    				<item name="en_link_url" pathid="en_link_url" rowcontinue="t">
    					<label>English link URL</label>
    					<description/>
    					<text size="40" required="f" />
    				</item>
    				<item name="fr_link_url" pathid="fr_link_url">
    					<label>French link URL</label>
    					<description/>
    					<text size="40" required="f" />
    				</item>
    				<item name="en_link_target" pathid="en_link_target" rowcontinue="t">
    					<label>English link Target</label>
    					<description/>
    					<select required="t" multiple="f">
    						<option selected="t" label="_top" />
    						<option selected="f" label="_blank" />
    						<option selected="f" label="_self" />
    					</select>
    					<text size="40" required="f" />
    				</item>
    				<item name="fe_link_target" pathid="fr_link_target" rowcontinue="t">
    					<label>French link Target</label>
    					<description/>
    					<select required="t" multiple="f">
    						<option selected="t" label="_top" />
    						<option selected="f" label="_blank" />
    						<option selected="f" label="_self" />
    					</select>
    					<text size="40" required="f" />
    				</item>
    			</container>
    		</root-container>
    		<script language="javascript" location="webserver" src="/iw/rogers/mainscript.js"> </script>
    		//<script language="javascript" location="webserver" src="/iw/rogers/connector.js"> </script>
    		<script language="javascript" location="webserver" src="/iw/rogers/rotatingbanner_connector.js"> </script>
    	</ruleset>
    </data-capture-requirements>
    Last edited by manishrathi; 07-10-2009 at 02:37 PM.

  2. #2
    Join Date
    Jan 2009
    Posts
    3,346
    What is the issue? I'm not going to run it on my computer to do QA to figure out what the problem is...

  3. #3
    Join Date
    Jun 2009
    Posts
    96
    When I include this javascript in the xml file and this xml file has hierarchy as <root>, <default> ,<image> , and when I display it as IWEventRegistry.addItemHandler("/root/"+region+"/image"), this instruction does not work. ie when I click on clear button, field is not getting cleared.

    while in case of IWEventRegistry.addItemHandler("/root/"+region+"/en_image", "onCallout", clearMediaBinFields) , button works fine. Why is that ?
    thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles