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?
spring80Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Minesh ShahSharePoint & all about itCommented:
where is the page mean to ask location and page name...
Minesh ShahSharePoint & all about itCommented:
on which the button appears
spring80Author Commented:
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?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Minesh ShahSharePoint & all about itCommented:
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
spring80Author Commented:
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 ?
Minesh ShahSharePoint & all about itCommented:
ok,
on site collection home page
click site actions > create page > choose redirect page (go through others at once atleast).
spring80Author Commented:
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 ?
chapmanjwCommented:
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.
spring80Author Commented:
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>
chapmanjwCommented:
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>
rebejonesCommented:
If I understand correctly you have a button on a SharePoint page that when clicked you want it to go to another page. What you will need to do is place the button on the page as normal. You will need to add the following to your web config file that runs the SharePoint page the button is on.

<PageParserPaths>

<PageParserPath VirtualPath="/pages/page.aspx" CompilationMode="Always" AllowServerSideScript="true" />

</PageParserPaths>

changing the pages to the link to where the button is. Also may want to move the javascript to the head tag.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
spring80Author Commented:
Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.