iFrame - URL from Column

Hello support team,

I would like to present an iFrame.
The iFrame is integrated via an HTML control.
The URL of the iframe should be read from a column. How can I specify this in the iFrame?

My current code:

<iframe src = "{@InternalColumnName}" width = "1250" height = "600" frameBorder = "1"> Browser not compatible. </ iframe>

The code does not work.

Thanks for your help.

Kind regards

Hello @RMIC,

This can be done using the script below. Please paste it JavaScript Editor.

If you don't want to display something on the form load, please leave the src in HTML control blank: src= ""

fd.spRendered(function(){
   
   function setiFrameURL () {
      $('iframe').attr('src', fd.field('HyperlinkFieldInternalName').value.url);
   }

//set URL on form load
setiFrameURL();

//set URL on Hyperlink fild change
fd.field('Hyperlink').$on('change',setiFrameURL);

});

Hello @mnikitina,

Thanks, it works great.

I have another question.
How can I hide columns on a form?
I tried it with the following code, but without success:

  • $(fd.field('Internal_Column').$parent.$el).hide();
  • $('.hide_fields').hide();

Thanks for your help.
Kind regards

@RMIC,

Could you please clarify what columns you want to hide.

Do you need to hide the column in 'List or Library' control? What is the condition?

Hello @mnikitina,

it is a column of type "link or image".
The column must remain on the form because I want to access the contents of the column. However, the column should be hidden for the user.
I can not hide the column in the content type.

Thanks for your help.
Kind regards

@RMIC,

You can either hide the field with the line
$(fd.field('FieldInternalName').$parent.$el).hide();

or assign the CSS class to all fields you want to hide and hide them all together with the line
$('.field-to-hide').hide();

image

Make sure that the Field Internal Name matches the name in the code. And the code runs under fd.spRendered.

You can find detailed information in 'Hide/show field or set of fields conditionally' article.

Thank you, it works.
My mistake was that the code did not run under fd.spRendered.
I do not know that yet. Forms is new to me. This was not needed in the Plumsail Forms Designer.

Thanks for your help.
Kind regards

1 Like