html frameset, how to target another frame with window.document.URL [closed] - html

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 days ago.
Improve this question
I know using frames is not ideal, but I am working on a legacy codebase.
I have the following setup, the webpage is divided into three HTML frames, as in the following image: wherein topnav contains a search input field, and the frame main should be redirected to another URL when a search is performed.
What I want to do is, when the user performs a search using the top nav search bar, the search results page (results.html) should be displayed on the main frame.
What currently happens is the topnav frame is the one getting redirected to results.html instead.
How do I target the main frame specifically to be the one to get redirected when a user performs a search using the topnav frame?
homepage.php
<frameset rows="124,*" cols="*" frameborder="NO" border="0" framespacing="0">
<frame name="topnav" noresize="" scrolling="NO" src="/Templates/topnav.php" />
<frameset rows="*" cols="240,*" frameborder="NO" border="0" framespacing="0">
<frame name="leftnav" scrolling="YES" noresize="" src="/Templates/leftnav.php" />
<frame name="body" src="main.php" scrolling="AUTO" />
</frameset>
</frameset>
topnav.php
<script language="javascript" type="text/javascript">
function searchit(){
var qvalue = document.getElementById("q").value;
var sortvalue = "relevancy";
var path="example.com/results.html#q="+qvalue+&sort="+sortvalue+"";
document.getElementById("seek").action=path;
window.document.URL=path;
// return true;
return false;
}
</script>
<form action="" method="post" name="seek" id="seek" onSubmit="searchit();" autocomplete="off">
<input name="q" type="text" id="q" />
<input type="submit" value="submit" name="submit" />
</form>

Related

Input tag has value but still is empty [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have a peculiar case here wherein the input tag has value in its value attribute but the input box is still empty on the page.
<input class="form-control myInput" id="myInputId" maxlength="10" name="test" type="text"
value="2244-0099ABC" style="border: 1px solid rgb(204, 204, 204);">
But when I try to add the same value which is present in the value attribute using jquery or at console, then the value appears.
Please let me know where it is that I'm going wrong.
Thanks
Try this..
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<input class="form-control myInput" id="myInputId" maxlength="10" name="test" type="text" style="border: 1px solid rgb(204, 204, 204);">
</body>
</html>
<script>
jQuery(document).ready(function(){
var data="2244-0099ABC";
jQuery(".myInput").val(data);
});
</script>

Extremelly Quick Start in HTML [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I want to make a HTML page with two components on it: Button and Edit. If I press on button then OpenDialogFile executes. After choosing a file, I want to see it's full path (f.e. "C:/temp_folder/superText.txt") inside my Edit.
<body>
<h1>FileCreator Page!</h1>
<form action="createCSV" method="get">
<input type="text" name="fileName" value="D:/">
<input type="file" value="Choose CSV" title="Choose"> <!-- title is not working-->
<input type="submit" value="Load file into DB">
</form>
<body>
Due to security reasons you can not set a value for an input type file tag.
Look at this thread for further information to this topic: set value for input type file
Also there is no attribute called "title", the text shown on the button is predifined by the browser and can not be changed.

My facebook app renders blank for some users

I have built facebook app. It's hosted on:
http://resihop.herokuapp.com/.
The app is suppose to be visible here:
https://apps.facebook.com/393963983989013/
On facebook it's embedded in an iframe. The weird part is that for some users the content of the iframe is empty, just:
and for some users it displays the page. Here is the html: that I got from inspect element:
Working:
<div>
<noscript><div class="mas"><div class="pam uiBoxRed">Du måste ha javascript aktiverat i din webbläsare för att använda Facebook-applikationer.</div></div></noscript>
<form action="https://resihop.herokuapp.com/?fb_source=search&ref=ts" method="post" target="iframe_canvas_fb_https" id="canvas_iframe_post_4fe8ad942b9be6531902412" onsubmit="return Event.__inlineSubmit(this,event)">
<input type="hidden" autocomplete="off" name="signed_request" value="x4b_ddxAkL71eQEdopzIZJpWZCmTPFqOMmmMvx_TCC8.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEzNDA2NTQ0MDAsImlzc3VlZF9hdCI6MTM0MDY0ODg1Miwib2F1dGhfdG9rZW4iOiJBQUFGbVR1TlI2UlVCQU9zQkRkc2hwbkpNN0pKR0ZaQTNsaGhtMlViNWFlWkFpeFpDNnNYcWVEbXpaQjVqb1dtVUwzVTg1WW5wUWg2WkJVdUxQV3o2M1lIQk5aQVQ4a3dNNGNtWkExZU00MXZ5SU5KeVpDeWFpbDhWIiwidXNlciI6eyJjb3VudHJ5Ijoic2UiLCJsb2NhbGUiOiJzdl9TRSIsImFnZSI6eyJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDAwMDA2MjcwMTQzODQifQ">
</form>
<iframe class="smart_sizing_iframe" frameborder="0" scrolling="yes" id="iframe_canvas" name="iframe_canvas_fb_https" src='javascript:""' height="800" style="height: 574px; "></iframe>
</div>
Broken:
<div>
<noscript><div class="mas"><div class="pam uiBoxRed">You need Javascript enabled in your browser to use Facebook Applications.</div></div></noscript>
<form action="https://resihop.herokuapp.com/" method="post" target="iframe_canvas_fb_https" id="canvas_iframe_post_4fe8adec0223e0f59580030" onsubmit="return Event.__inlineSubmit(this,event)">
<input type="hidden" autocomplete="off" name="signed_request" value="yx5eMWJ-0WFSOHg5bkfxesurLc5zZcfuYdyuJqffv0M.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEzNDA2NTQ0MDAsImlzc3VlZF9hdCI6MTM0MDY0ODk0MCwib2F1dGhfdG9rZW4iOiJBQUFGbVR1TlI2UlVCQUJ6NVRxdWRuaW1tN01ZVzRkdXhSMHczTU1zcDZvbU9ZZ3ZZVm1zZG11dVJLN1lEb1h6Mm9TYUFIeUpaQ2NsSjg5cFBFWkJaQ2haQURyMGZCWWIxOUxaQ0o0QnVaQnR3WkRaRCIsInVzZXIiOnsiY291bnRyeSI6InNlIiwibG9jYWxlIjoiZW5fVVMiLCJhZ2UiOnsibWluIjoyMX19LCJ1c2VyX2lkIjoiNjUxNjY2NDgzIn0"></form>
<iframe class="smart_sizing_iframe" frameborder="0" scrolling="yes" id="iframe_canvas" name="iframe_canvas_fb_https" src='javascript:""' height="800" style="height: 294px; "></iframe>
</div>
One difference I have noticed is that the actions are different. I have waited for several hours now, so it might be a server-unsync-thing, but probably not.

Best solution to POST data to an iFrame on a different page?

On every page of my website, I have the following form in the sidebar (don't worry about the static values of the form):
<form target="booking_iframe" name="form1" method="post" action="/booking" id="le_booking_form">
<div class="form_row">CHECK IN
<input name="side_check_in_date" type="text" class="stwths_input" id="checkin" value="2012-03-05">
</div>
<div class="form_row">CHECK OUT
<input name="side_check_out_date" type="text" class="stwths_input" id="checkout" value="2012-03-10">
</div>
<div class="stwths_submit_box"><input type="submit" name="button" id="button" value="Submit" class="stwths_submit" rel="follow"></div>
</form>
What the form needs to do is POST the side_check_in_date and side_check_out_date to an iFrame on the booking page which the form sends you to when you hit Submit so the user can fill in the form that appears on this booking page.
Here's the code from the booking page:
<iframe name="booking_iframe" src="http://thestrandreservation.spin-demo.com/?ptype=user_booking" width="690" height="3000" border="0" frameborder="0" scrolling="no"></iframe>
You can see the home and booking pages below:
http://thestrand.spin-demo.com/
http://thestrand.spin-demo.com/booking
On the booking page, you need to insert value="{CHECK_IN_DATE}" and value="{CHECK_OUT_DATE}" into your form with the id="reservation_frm". That needs to happen server side, because you are posting this data from your stay_withus_form.
I don't know what server technology you are using, whether it's php, ruby, or .net it doesn't matter.
Then use Javascript on the booking page to submit the reservation_frm form:
using plain old Javascript:
document.forms["reservation_frm"].submit();
or using jQuery
$("#reservation_frm").submit();

Using HTML in form value

Simple question, however I can't find an answer anywhere.
I need a text input that can display HTML in it's value i.e:
<input type="text" name="guest_sc_player" id="guest_sc_player" size="27" value="<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F34196707&show_artwork=true"></iframe>" />
Most of the other answers will work for this specific situation, but the correct way to do this is to HTML Encode the entire value:
<input type="text" name="guest_sc_player" id="guest_sc_player" size="27" value="<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F34196707&show_artwork=true"></iframe>" />​​​​​​​​
jsfiddle
This avoids the necessity of worrying whether there may be single or double quotes in the value string. Depending on what platform you're using, there's probably a convenience method to do this automatically. e.g. HttpUtility.HtmlEncode in .NET
<input type="text" name="guest_sc_player" id="guest_sc_player" size="27" value='<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F34196707&show_artwork=true"></iframe>' />
single quotes work too.
Replace those double quotes within the value property with ".
First, you need to encode all the characters that are required to be encoded.
Then, you can surround the string in single quotes.
<input type="text" name="guest_sc_player" id="guest_sc_player" size="27" value='<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F34196707&show_artwork=true"></iframe>' />