Link to home
Start Free TrialLog in
Avatar of spring80
spring80

asked on

insert a html form code into sharepoint

Dear Sir
 i want to enter this code into my sharepoint , so when the button clicked the code will be run :

<form method="post" action="XXXXXXXXXXX">
<input value="http://" name="q" type="text" class="bar" onFocus="this.select()" />
<input type="submit" class="submit" value="" onclick="opendialog()" style="width: 88px; margin-left: 0px" />
</form>

i tried using the page viewer web part without success, and trying using content editor web part without success also.
What should i do?
Avatar of Minesh Shah
Minesh Shah
Flag of India image

where is the page mean to ask location and page name...
on which the button appears
Avatar of spring80
spring80

ASKER

dear sir
this the html code :
<html >
<head>
</head>
<body>
<div class="address">  
<form method="post" action="http://fuegocraft.com/index.php">
<input value="http://" name="q" type="text" class="bar" onFocus="this.select()" />
<input type="submit" class="submit" value="Go"  />

</form>
<script type="text/javascript">
function opendialog()
{
var options=SP.UI.$create_DialogOptions();
options.width= 900;
options.height= 700;
options.dialogReturnValueCallback= Function.createDelegate(null, CloseCallback);
SP.UI.ModalDialog.showModalDialog(options);
}

</script>
</body>
</html>


if  i run the html file through internet explorer ,it is work fine, but when i need to put in a button in sharepoint there is error.

the idea of this code is : 1-this site can open the restricted site, so i want to put this code in sharepoint to allow the user to surf the restricted page .
2- the idea of the open dialog to not allow the user to see the url of this page


What should i do?
go to site collection
edit page
add web part
content editor wp
open source editor copy your code save say ok... publish ..and check.

let me know if any confusion
Dear Sir

first, in content editor there is source editor, only content link .
i put the code in it and doesnt'work , i put the code in text file and put it in document library , in content editor ,i put the link in the content link, doesn't work also.

second , i want to create a simple html page to put my code in it ,how can i create this html page ?
ok,
on site collection home page
click site actions > create page > choose redirect page (go through others at once atleast).
i don't understand what you said .
please explain more.

when i create a page in sharepoint 2010 ,there is no redirect page .
and how this redirect page solve my need ?
Since SharePoint is .NET based, it is already creating a <form> tag that contains all the page content.  HTML doesn't allow for you to have a <form> tag within another <form> tag.  This means, simply putting your <form> inside a Content Editor Web Part will not work because to the web browser it is seeing a <form> within a <form>.

The best work around for this is to create an HTML page that only contains the <form>.  Put the HTML file in a document library in SharePoint.  Then use a Page Viewer Web Part to display the HTML page.  This will render the second <form> in an IFrame, which web browsers consider to be a separate page altogether.  This is the only way to use an HTML <form> on a SharePoint page.
ok i did it but also problem, when choose page viewer web part, i have three option "webpage , folder, file" with the link , i insert the location of the html file in the link . if i choose"file "a red message appear "The file name or path is not valid for the Link property. Check the spelling and syntax, and then type it again"

if i choose " web page" a popup window appear if i want to save the file , and a problem happen to this page , i should delete and recreate it again.

i want this code to work in my sharepoint
<form method="post" action="http://fuegocraft.com/index.php" target=_blank>
<input value="http://" name="q" type="text" class="bar" onFocus="this.select()" />
<input type="submit" class="submit" value="go" />

</form>
The .HTML file should have:

<html>
<head><title>Form Title</title></head>
<body>
<form method="post" action="http://fuegocraft.com/index.php" target=_blank>
<input value="http://" name="q" type="text" class="bar" onFocus="this.select()" />
<input type="submit" class="submit" value="go" />

</form>
</body>
ASKER CERTIFIED SOLUTION
Avatar of rebejones
rebejones

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks