/    Sign up×
Community /Pin to ProfileBookmark

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/”+[b]region[/b]+”/banner_slides/en_image”);
mb_makeReadOnly(“/root/”+[b]region[/b]+”/banner_slides/fr_image”);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/banner_slides/en_image”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/banner_slides/fr_image”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/en_image”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/fr_image”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/image”, “onCallout”, clearMediaBinFields); //For Search Component

mb_makeReadOnly(“/root/”+[b]region[/b]+”/block/en_image”);
mb_makeReadOnly(“/root/”+[b]region[/b]+”/block/fr_image”);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/block/en_image”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/block/fr_image”, “onCallout”, clearMediaBinFields);

mb_makeReadOnly(“/root/”+[b]region[/b]+”/promo/block/en_image”);
mb_makeReadOnly(“/root/”+[b]region[/b]+”/promo/block/fr_image”);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/promo/block/en_image”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/promo/block/fr_image”, “onCallout”, clearMediaBinFields);

mb_makeReadOnly(“/root/”+[b]region[/b]+”/nested/block/en_image”);
mb_makeReadOnly(“/root/”+[b]region[/b]+”/nested/block/fr_image”);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/nested/block/en_image”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/nested/block/fr_image”, “onCallout”, clearMediaBinFields);

mb_makeReadOnly(“/root/”+[b]region[/b]+”/en_image_small”);
mb_makeReadOnly(“/root/”+[b]region[/b]+”/fr_image_small”);
mb_makeReadOnly(“/root/”+[b]region[/b]+”/en_image_large”);
mb_makeReadOnly(“/root/”+[b]region[/b]+”/fr_image_large”);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/en_image_small”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/fr_image_small”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/en_image_large”, “onCallout”, clearMediaBinFields);
IWEventRegistry.addItemHandler(“/root/”+[b]region[/b]+”/fr_image_large”, “onCallout”, clearMediaBinFields);

[/code]

[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> [/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@criterion9Jul 10.2009 — What is the issue? I'm not going to run it on my computer to do QA to figure out what the problem is...
Copy linkTweet thisAlerts:
@manishrathiauthorJul 10.2009 — 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
×

Success!

Help @manishrathi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...