sivaprasad9394
Occasional Collector

How to get the master language text box value at run time.??

Jump to solution

Hello All,

I would like to get the master language text box value, if there is not value in the other language text box? I hope these things can happen in page generation time?

Here i don't want to fill the value of short-id in the text box.Just want to set it while generation time.

This is a fall back condition if no value is entered  Master language value will be set for all the other remaining language.

Attached some image for your reference.

Form:

<CMS_INPUT_TEXT name="ptMediasuiteID" editable="yes" hFill="no" length="25" noBreak="yes" useLanguages="yes">
  <LANGINFOS>
    <LANGINFO lang="*" label="Short-ID:"/>
  </LANGINFOS>
</CMS_INPUT_TEXT>

Format Template:

$CMS_IF(!ptMediasuiteID.isEmpty)$

    $CMS_SET(mediasuiteId, ptMediasuiteID.toString)$

$CMS_ELSE$

    $CMS_SET(mediasuiteId)$$CMS_VALUE(#this.formData.get(#global.project.masterLanguage, "ptMediasuiteID").get)$$CMS_END_SET$

   print $CMS_VALUE(#global.project.masterLanguage)$ $CMS_VALUE(mediasuiteId)$

$CMS_END_IF$

<iframe id="video_iframe" width="$CMS_VALUE(iframe_width)$px" height="$CMS_RENDER(script:"getvideoheight",width:iframe_width.toString(),ratio:ptMediasuiteAssetRatio.toString(),subtitlesIncluded:ptMediasuiteAssetSubtitlesIncluded.toString())$px" src="$CMS_VALUE(psMediasuiteUri)$/$CMS_VALUE(psMediasuiteMandator)$/$CMS_VALUE(mediasuiteId, default: ptMediasuiteID)$/$CMS_VALUE(iframe_width)$" frameborder="0" scrolling="no" style="margin-left: $CMS_VALUE(marginLeft)$px;"></iframe>

FS_Version:5.2.426

outPut_EN.png

outPut_ES.png

outPut_Generation.png

Thank you.

Regards,

Siva

0 Kudos
1 Solution

Accepted Solutions

Hi Siva,

I am not 100% sure if I understand your question correctly, but I think there are multiple ways how you could solve this issue.

  • You could make changes to the validation rules of the form and prevent approval of the page if the ptMediasuiteId is not filled for EN. It would then not be rendered, and it would be clear for editors as well why it is not displayed.
  • You could guard the whole rendering of the template (after setting mediasuiteid) by a $CMS_IF(!mediasuiteId.isEmpty())$...., which should not show the contents at all. This should also not show any borders, since there will be no element where CSS could tie to.

Cheers,

Lena

View solution in original post

0 Kudos
3 Replies
pavone
I'm new here

Hi Siva,

your code looks fine to me and also seems to work. Are you sure the page is marked as fully translated for EN?

Regards

Tim

0 Kudos

Hello Tim,

Thank you for your reply.

Solved it by using the #this and other methods.

I have a question here Is it possible to hide the section at run time page generation,Suppose Master language EN text box no Media Short-id is entered.

Here I have to hide the section, if EN is empty and all the other language Dependent text boxes are empty.

Reason behind hiding all the other language is there is no value in EN text box and fall back of EN text box value will not be there in other languages too.

At Runtime based on EN value need to hide the section??

Also

<iframe id="video_iframe" width="$CMS_VALUE(iframe_width)$px" height="$CMS_RENDER(script:"getvideoheight",width:iframe_width.toString(),ratio:ptMediasuiteAssetRatio.toString(),subtitlesIncluded:ptMediasuiteAssetSubtitlesIncluded.toString())$px" src="$CMS_VALUE(psMediasuiteUri)$/$CMS_VALUE(psMediasuiteMandator)$/$CMS_VALUE(mediasuiteId, default: ptMediasuiteID)$/$CMS_VALUE(iframe_width)$" frameborder="0" scrolling="no" style="margin-left: $CMS_VALUE(marginLeft)$px;"></iframe>

Rendering is happening inside the format template. If I do hide here 'Page not found will not be displayed'.But CSS will be displayed right in live web page suppose if the section has borders and colours???

Thank you.

0 Kudos

Hi Siva,

I am not 100% sure if I understand your question correctly, but I think there are multiple ways how you could solve this issue.

  • You could make changes to the validation rules of the form and prevent approval of the page if the ptMediasuiteId is not filled for EN. It would then not be rendered, and it would be clear for editors as well why it is not displayed.
  • You could guard the whole rendering of the template (after setting mediasuiteid) by a $CMS_IF(!mediasuiteId.isEmpty())$...., which should not show the contents at all. This should also not show any borders, since there will be no element where CSS could tie to.

Cheers,

Lena

0 Kudos