...

View Full Version : Need help in Redirecting



Venice_Yan
09-23-2011, 12:10 PM
Hello everyone,

I have a code here:

<input type="submit" class="submitblog" onclick="document.getElementById('entry_draft').value=0; document.forms['frmNewBlog'].submit();return false;" value="Submit" />

How can i add a redirect page? I mean what is the code that i will add so that when my user click's submit, they will redirect to example.com/mypage

Thank you so much.

Ive been trying to figured it out but i have no luck at all... So i came up asking for help.

MtheGreat
09-23-2011, 02:13 PM
Hi,

You can put a <a href=""></a> tag around your code for your button, but then the onclick event in the button might not work.

so it would look like this:

<a href="page.you.want.to.link.to"> <input type="button"......./> </a>

hope this helps

Venice_Yan
09-24-2011, 01:41 AM
Thank you for the reply. I got two input types. "Submit" and "Button". I tried to exclude my submit input type and just use the button input type, but still dont work.

Here is the code for my button input type:

<input type="button" class="submitblog" onclick="document.location='http://exampleofmypage.com/blog/entries'; return false;" value="Cancel"/>

My input button is use for "cancel"

Here is the code for the submit input:

<input type="submit" class="submitblog" onclick="document.getElementById('entry_draft').value=0; document.forms['frmNewBlog'].submit();return false;" value="Submit" />

Is there any way or any code i still can add in my submit input? So it will redirect?

Thank you so much.

Fou-Lu
09-24-2011, 04:40 AM
Despite the similar sounding names, Java is not the same as Javascript.
Moving from Java forum to Javascript forum.

Philip M
09-24-2011, 08:51 AM
How can i add a redirect page? I mean what is the code that i will add so that when my user click's submit, they will redirect to example.com/mypage


You can't with Javascript. The submit refreshes/reloads the page. You need to use server-side scripting.
The redirect after submit should be done in the PHP document which is the target of the form submission.

document.location is an invalid object reference. That should be window.location

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum