javascript: display form in iframe - javascript

I am new to the world of programming (I mean really new, like 2 months old)... so I apologize for the really basic question.I have been struggling with this problem for two full days with no idea how to do it.
Have a regular page with a form whose fields are hidden. Once you select an option, fields pop up (name, email, etc.).
I have an iframe on the same page.
I would like to display the actual form/fields (name, email, etc.) inside the iframe.
Submit form and send data to mysql (php file executing the transmission). (This part is done, all outside the iframe, except the final message)
Tried to create a function, tried TARGET (this one displays the actual result of the form inside the iframe - successful - data sent to mysql..etc.). But the form is still outside the iframe.
Any suggestion will be greatly appreciated!

Related

Link form fields response in sql database to Html

How do I link form field (like every time someone fills a form I get an update on the homepage, where it says number of reported cases, by different categories) to update on an html element. Probably from an sql database. I’m coding in HTML, CSS, JS.
Also, Please if you know any video that explain more anywhere, kindly link to it in your response.

Post JavaScript between two sides

my situation:
I have two pages, let them be Pagestart.html and PageFinish.html.
PageFinish.html contains a simple form with a textbox and I am not allowed to change this page.... :-(.
On Pagestart.html, I have a dynamic webpage, that receives data from a database and based on this data I have to change the textbox on PageFinish.html via JavaScript...
The scenario is, the user clicks on the link to PageFinish.html and with this I need a parameter containing javascript that is executed on the PageFinish.html site and does this job for me...
My Javascriptcode is fine and it is working if I execute it on the PageFinish.html page, but sending this code via the link is not possible.
Thank You!

Storing data client-side from one page to fill out a form on the other site

I'd like to help the visitors to my site to fill out a form on the other site (beyond control) using the data, generated on my site.
It would be possible to use a bookmarklet to post the data to the form while the user is on my site, but the form is some clicks behind the authentication. Considering that a bookmarklet may read only what's been stored (cookie, session, storage) while on the current site, it is not possible to use the bookmarklet on the other site to fill out the form with data, stored while on my site.
Please, suggest any javascript, client-side solutions of this. Like a bookmarklet or something similar.
Thank you.
With a bookmarklet I'd say you're on the right track, but use a dynamic one. e.g:
function makeBookmarklet(){
var elt=document.createElement('a');
var hrefString='';
for(var k=0;k<arguments.length;k++){
hrefString+=' document.getElementById("'+arguments[k].id+'").value="'+arguments[k].value+'";';
}
elt.href=hrefString;
return elt;
}
And then you would call that function, and each argument should be an object with an id and value attribute. The id should be the id of the field to automatically fill out. value should be the value to insert into that field. It returns an element, so put it somewhere in the document and tell the user to drag it into the bookmarks bar, and click it on the other site. Just to make it clearer, you would call it like this:
aElt=makeBookmarklet({id:'username',value:document.getElementById('username').value},{id:'othercrap',value:'fixedvalue'});

pass form values from one page to a hidden iframe inside page

I am trying to take on a new project creatively. Basically, I have a website where I want to put a custom form and a hidden iframe which will contain its own form. What I want is that when I press the submit button on the page's form, the values of say the text boxes will be passed to the iframe's form's text boxes and then submit the hidden form and display in a visible iframe the results.
I have looked through other questions, but none seem to have the same goal as I.
Is this possible? If so, how? I would highly appreciate any help.
nvncbl
If I've understood you correctly, you want to pass some input parameters without the page reload. If so, then you should dig into ajax in order to call asynchronously different parts of the web page.
Fortunatelly there are many frameworks that can help you. I prefer Knockout.js, but you can use for instance Angular.js or Backbone.js and so on.

How to pre-fill a form using jquery/javascript

I have to pre-fill a form on this page that I open using javascript. The best code I have managed to come up with thus far is
submitpage = window.open('http://localhost/bookmarks/submitbookmark');
submitpage.getElementsByName("title")[0].value="Good Luck";
I have no control over the page that opens. When I manually fill the form, it works fine and submits everything. Its when I pass variables in the url that it does not accept some. The problem is that none of the form elements on the third party page have id's, so i have to use the getElementsByName() function but the good thing is that there are only four elements, all with unique names so i can use the function like this getElementsByName()[0].
Now, I want to see the form pre-filled with values and leave the option of submitting to the user by clicking the submit/post button. Just for reference, the form method="POST".

Categories

Resources