I'm new to SharePoint but I was wondering if there was a way to pass variables from an external website to a SharePoint Web Part via GET.
e.g.
http://mysharepointpage.com/sites?name=Jay&age=23 does not populate my name or age input fields in the SharePoint Web Part.
Note: I had to remove the <form method="GET"> tags because I kept getting an error advising;
<FORM> tags are not supported in the HTML specified in either the Content property or the Content Link property. You can
remove the <FORM> tag, or use the Page Viewer Web Part, which supports the HTML <FORM> tag. The Content property can
be modified in the Rich Text Editor or Source Editor. More about the Page Viewer Web Part
When I click on the link it tells me;
Cannot display help.
Technical details: HC not found.
I'm guessing this is why I can't retrieve the data via URL.
A little more information as to how would be much appreciated.
Your query string looks correct:
Connect a Query String (URL) Filter Web Part to another Web Part
You will then need to implement javascript on the page to loop through all the keys and populate the form as required.
You should be able to use this link to help you with your javascript or please post what you are currently using: Getting query string values in JavaScript
Related
I am working on a html page with an input bar. How can I get the form data from this page to another html page with a iframe? Because I need to embed the search result from other site but I want to show on my site new page. I just guess should use iframe. But I don't know how to get data and add in page address field.
You have several options here:
1) If your form uses GET method, then all the text data from the form will be passed to next page (which is set up as an "action" attribute of the form) in URL (like www.example.com/?name=John&lastname=Doe). After that, you can extract data from this URL using code from this StackOverflow question and put it inside HTML element using Javascript as well like it is done here
2) Whatever server language you use, you can get query variables from there and put them to the page before sending it to the client. In case of PHP, check this example. NB: don't forget about security.
3) You can temporarily store text in localStorage API of the browser. Simply set the value before submitting the form and then get it on the next page.
iFrame would be inefficient and not needed here.
I am new to Java EE. In my application, I have a HTML page containing a text area filled with some information.
I also have a form for the user. Once he submits the form, I use a servlet to process the information.
Finally I need to forward the Result from the servlet to the same HTML page and update it in the existing textarea.
I have done creation of HTML page, submitted the form to servlet.
I am now stuck on how to access the textarea in the HTML page to update my result.
I googled a lot but everywhere people forward the result of servlet to JSP page and create a fresh HTML page using "out" object.
I need to use the same textarea of my HTML page to update the result. Please help me on achieving this.
Thanks in advance.
There are two ways to do this.
Server-side rendering. You can re-draw the whole page, with a normal form submit. In this case you would put something in request scope in the servlet and then access that in the JSP when you draw the textarea. Note that you are not accessing the HTML textarea in the JSP - the JSP runs server-side code to generate HTML markup, but you are not accessing the browser DOM directly.
This might look like:
servlet: request.setAttribute("textareaContent", varWithTextareaContent)
JSP: <textarea>${textareaContent}</textarea>
Client-side rendering Instead, you could make an AJAX post request with jQuery (there are some plugins to help with this). In this case, your servlet would not forward to a JSP for HTML rendering - it would directly return a JSON object like {"textareaContent": ...} , and you would handle that client-side in your AJAX callback. In this case you would be accessing the textarea in the browser DOM directly, in Javascript (not JSP).
I am trying to access one tag in index.jsp page to fetch it's value and access the input tag html value to one java variable value in the same jsp page (index.jsp)
I am trying to use the variable to connect to database and fetch other details in the same jsp page but that html input tag value is not assigned to java variable using request object and tried in many ways but was unable to assign the value...
is there any method/idea to assign the html input tag=text value to java variable in same jsp page without using JSLT?
Appreciate your response
I've decided to answer this because I've seen many green programmers get confused about this same exact subject for many HTML preprocessing languages (JSP in this case). I'm going to start off right away saying this is an XY problem, please see https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem .
After reading about what an XY problem is, the actual problem here ("X"), is that you can't access HTML elements at time of user interaction with JSP. JSP generates the HTML on the server. The HTML is then sent to the Client, the JSP code is done, and no longer able to do anything with the page because it isn't on the server. Now the HTML is on the client side and a user would enter the value you want. The server really has no access to the page anymore and it is impossible for the JSP code that generated the page to access the value.
Essentially, it is not possible to access an HTML element with JSP without doing this another very different way (sending value by ajax or something).
I am learning html from w3schools. They have used <form action="demo_form.asp"> this form tag with attribute action="demo_form.asp. I know the meaning of form tag as well as action attribute. But I don't know what is the meaning of action="demo_form.asp". When I use this attribute action="demo_form.asp", a file named demo_form.asp start downloading!
Can anybody explain me this thing?
Full code is here.
action attribute define the page to be use to post the data, when you hit submit button it redirect to the page you have mentioned in the action attribute. so that you can access the data submitted through this page.
The action="demo_form.asp" attribute is the file to which your <form> will be submitted.
From HTML spec
action = uri [CT]
This attribute specifies a form processing agent.
It's used to send the request to the page (url) specified in the action attribute when the form is submitted.
As per the example:
Once you enter your favourite color in the input box & click submit.
The form details is sent to the server page (demo_form.jsp) based on form action.
There the form is processed and based on the input, it's redirecting you to different page.
Where you can find the fav color which you have entered is mentioned there.
Input was received as:
favcolor=blue
The value of the action attribute tells the browser the location of the script that will process this form. In the example you have provided, the data submitted by the user in the form will be processed by the file/script called demo_form.asp.
The action element points to a thing that will handle the content of the form you have submitted. This can be as simple as a new page (maybe php), or a .cgi script, and so on. In your case it is attempting to submit to an ASP page. If you are attempting to use the form in your own pages, it is likely your browser can't find 'demo_form.asp'.
Why it is attempting to download it, rather than just tell you the page is missing, I'm afraid I don't know.
Hope this helps.
demo_form.asp should execute and not download. How are you running the file? It looks like your IIS is not enabled.
If you are trying this locally, to run ASP you'll have to configure IIS in your system (it is not enabled by default) and then use
http://localhost
.... to run your file. Otherwise ASP will not execute. See http://msdn.microsoft.com/en-us/library/ms181052(v=vs.80).aspx for enabling IIS. Once IIS is enabled,
http://localhost
will point to c:\inetpub\wwwroot folder by default. Create a folder in wwroot (say test) and place your files inside that folder. If your file is abc.asp then to run it you'll have to type
http://localhost/test/abc.asp
.
Hope this helps.
I want to create an html page which contains a text box. When I am given input and the Enter key is pressed, I want it to go to another html page and display the typed keyword.
How can I do this?
I think you need to use a server-side scripting language to facilitate the manipulation of the inputted data on the form, so that it gets "saved" and displayed in the other html page. I suggest you try reading about PHP, and then turn to handling information in Web Forms...just a thought!
You can use Javascript for that. Check this Tutorial : How do I pass variables between two pages? (GET method)