How to pass querystring value into iframe src - javascript

I have a normal link button where I am getting data through like this
<a href="ViewRemarks.aspx?jobid=<%#DataBinder.Eval(Container.DataItem,"jobid")
%>" id="btn_remarks" data-toggle="modal" data-target="#exampleModalCenter3"
class="open-AddBookDialog btn btn-outline-info " ><i class="fa fa-comments" ></i>
</a>
Note: in this button, I am getting data called job id
Then I took one bootstrap modal inside that modal I kept one child page like this
<iframe style="width: 470px; height: 195px;" id="Iframe1" class="embed-responsive embed-responsive-16by9" src="ViewRemarks.aspx?jobid=null"></iframe>
Note: iframe is not showing in stackoverflow don't know why but yes that is an iframe so i kept one a before iframe.
But here I want to pass that particular jobid from that button inside the data table how can I solve this in asp.net or javascript anything is accepted please help.

So use the link target which will load the link in the iframe.
<iframe name="iframe1" id="iframe1" />
and the link
My LInk
<iframe name="iframe1" id="iframe1"></iframe>
My LInk

Related

Open Bootstrap Model and Load load iframe with one button

I need a button to open both "Bootstrap Modal" and Load iframe.
for now i have following concept:
User click on Modal Button Modal opens and then user need to click on another button in the Modal to load the iframe.
i found some solutions, but most of them using javascript with url in it. in my case i cant use this because i get the url from a button where this button has a dynamic id that get generated by a shortcode. as well i cant add this shortcode in the javascript, i already tried.
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#fileShareModal[wpv-post-id]">Open Modal</a>
<a class="btn btn-warning" href="[wpv-post-url]?layout_id=201" target="myiFrame[wpv-post-id]">click to load iframe</a>
<iframe name="myiFrame[wpv-post-id]" src="about:blank" class="max-h-600"></iframe>
I would like to get the dropdown-item button to open the modal and load the iframe. is that possible while keeping the structure of my urls the same?
You can open modals with jquery:
`
$(selector).modal("show");
`
So that means you can add an event to the button wich loads the iframe, and also open the modal
You need to add ids to each button:
`
$(idOfTheIframeLoader).click(e =>
$(idOfModal).modal("show")
);
`

Colorbox IFrame opens a URL in the browser instead of a box

I used Colorbox in my aspx project and I used the Iframe from example 1. I copied the css and js files mentioned in the html page but when clicking on the link, it opens up the page in the browser itself whereas I want it to show up in the box like in the examples.
Here's the code -
<a class='iframe' href="#" onclick="$.colorbox({href:'http://wikipedia.com', iframe:true, width:'90%', height:'90%'});">Click here</a>
You need to render the colorbox in an element on the page:
<a class='iframe' href="#" onclick="$('#container').colorbox({href:'http://wikipedia.com', iframe:true, width:'90%', height:'90%'});">Click here</a>
<div id="container"></div>
You must instead do this -
Click me
<iframe id="frame1" src="your_default_src"></iframe>

Selenium IDE select window without href or url

I am new in Selenium IDE. I try to select a PDF that opens during the test, but it doesn't work. I'am testing a Webapplication that is written on JSF and so includes some Java-Methodes/Classes.
I want to test if the PDF opens correctly or not. The problem is, there is no direct href in the HTML-Code. Only a Java(?)-Methode who opens the PDF. Is there any solution for this problem in Selenium IDE?
The Element you can click on is
<h:commandLink id="createDokument" style="background-image: none;" styleClass="Button Blue"
action="#{myBean.checkDocument()}" value="#{buttons['BTN_Document']}">
</h:commandLink>
Then a javaScript function should test if a pdf can be created
IF yes the hidden button is clicked:
<h:commandLink id="createDocumentPdf" style="background-image: none; display: none;"
styleClass="Button Blue"action="#{myBean.createDocument()}" value="something" target="_blank">
</h:commandLink>
What Firebug knows from this two buttons is:
<a id="mainForm:createDocumentPdf" class="Button Blue" onclick="if(typeof jsfcljs == 'function'){jsfcljs
(document.getElementById('mainForm'),{'mainForm:createDocumentPdf':'mainForm:createDocumentPdf'},'_blank');}return false"
style="background-image: none; display: none;" href="#">Something </a>
<a id="mainForm:createDocument" class="Button Blue" onclick="if(typeof jsfcljs =='function'){jsfcljs
(document.getElementById('mainForm') {'mainForm:createDocument':'mainForm:createDocument'},'');return false
"style="background-image:none;" href="#" tabindex="0">Document</a>
I tried a few things already but nothing works....
I tried: select window | titleOfThePDFWindow
but it does not work
so all I have now is:
clickAndWait | id=mainForm:createDocument

How Call link tag by id by javascript?

<img src="images/icon2.png" border=0 onClick="window.document.getElementById('loadimg')">
<a href="images/img.jpg" id='loadimg'></a>
i want when click the image will active the link by id='loadimg'
how can i do i try write onClick="window.document.getElementById('loadimg')" but not work
Than you
You can put the image in the link:
<a href="images/img.jpg" id='loadimg'>
<img src="images/icon2.png" border="0" />
</a>
It seems you want the item in the link to be loaded so something like this should work:
window.location.href = window.document.getElementById('loadimg').href;
This will cause the broswer page to navigate to this url.
Or was there something else you wanted to do?

How to get selenium to click on an object other than by ID

So here is a little challenge. I have an image. It has 2 attributes:
a random ID - not helpful
an image url - but it is a button, and other buttons use the same image url, not helpful
a CSS class - also used by too many other things to be helpful
a style - neither helpful nor unique
This image is however inside of an anchor tag, but the anchor tab isn't to a page, it just runs some javascript. Bellow is the html in question:
<a id="template:j_id__ctru168pc2"
title="Click for the Manual Class LOV" class="xei" style="text-decoration: none;"
onclick="return false;" href="#">
<img id="template:j_id__ctru169pc2" class="xgs"
style="border: 0pt none;" src="images/lov_ena.png">
</a>
How can I click this image without using the ID?
selenium.click("//a[#title='Click for the Manual Class LOV']/img");

Categories