Go Back   Serif Software Forums > Design and Publishing > WebPlus

Notices

WebPlus Questions about using WebPlus for website design

Reply
 
Thread Tools Display Modes
Old 12th August 2012, 11:35 AM   #1
YorkieBar
New Member
 
Join Date: Mar 2012
Posts: 7
YorkieBar is on a distinguished road
Question Redirecting a user to a page depending on the value of an edit box

Hi,

I'm trying to get a new site up and running, using WebPlus X5. I want to make a feature on the homepage of my site that, when you enter a value into the box and press Submit, the page simply redirects the user to the correct page depending on that value. I will be using this as a tracking device for tracking orders from my site shop.

Example:
User enters valid tracking number (in a list or something) and clicks Submit - Something like ABC123. The form then checks that the number exists from a list and if it does redirects the user to www.mywebsite.com/track/<trackingnumber>, the <trackingnumber> being ABC123 as previously entered. If invalid, a message will show.

So, the problem is - how would I do this? I have NO experience whatsoever in scripting (sorry!) and have been searching for an answer to this problem for a while now!

Even if this isn't possible, could the form just not check the tracking number and simply stick it on the end of the URL www.mywebsite.com/track/<...>.html?

Thanks in advance
- Yorkie Bar.
YorkieBar is offline   Reply With Quote
Old 12th August 2012, 12:17 PM   #2
Archibald
Master
 
Archibald's Avatar
 
Join Date: Feb 2009
Location: England
Posts: 12,833
Archibald is a splendid one to beholdArchibald is a splendid one to beholdArchibald is a splendid one to behold
Default Re: Redirecting a user to a page depending on the value of an edit box

Try the attached file, previewing site, not page, in a browser.

Valid tracking numbers need to be listed in the JavaScript within the HTML fragment. At present ABC123, DEF456 and XYZ789 are valid.

Let me know if you wish to use lower-case file names.

At present the redirection opens a new window. The size of window can be specified but you may prefer to open the new page in the same window.
Attached Files
File Type: wpp Tracking number1.wpp (26.2 KB, 23 views)
__________________
Archibald
Archibald is online now   Reply With Quote
Old 12th August 2012, 12:34 PM   #3
YorkieBar
New Member
 
Join Date: Mar 2012
Posts: 7
YorkieBar is on a distinguished road
Smile Re: Redirecting a user to a page depending on the value of an edit box

Wow, thanks for that!

I have had a little look inside the coding of the scripts and can understand how to tweak it a little to get the results I want.

Could I ask you to make the script suit my site a bit better please? If possible, it would be great to have:
- A button instead of an arrow (that works when you hit enter so you don't have to click it)
- Always opens in same window
- The link to the page being /track/<trackingnumber>.html

Apart from that, I can work the rest out myself and, assuming I could just copy and paste this into my site, would work a treat!

Thank you so much for this response!
YorkieBar is offline   Reply With Quote
Old 12th August 2012, 01:53 PM   #4
Archibald
Master
 
Archibald's Avatar
 
Join Date: Feb 2009
Location: England
Posts: 12,833
Archibald is a splendid one to beholdArchibald is a splendid one to beholdArchibald is a splendid one to behold
Default Re: Redirecting a user to a page depending on the value of an edit box

Quote:
Originally Posted by YorkieBar View Post
If possible, it would be great to have:
- A button instead of an arrow (that works when you hit enter so you don't have to click it)
- Always opens in same window
- The link to the page being /track/<trackingnumber>.html
Try the version attached.

It does not work when you press the enter key.

You should be able to copy the HTML fragment, but make sure your edit box has ID of "trackBox" (without quotation marks) and that 'Write ID for this object' is set to 'Yes'. See how custom script has been applied to the button.

Do you want it to work if upper or lower case letters are entered?
Attached Files
File Type: wpp Tracking number2.wpp (22.2 KB, 15 views)
__________________
Archibald
Archibald is online now   Reply With Quote
Old 12th August 2012, 02:45 PM   #5
YorkieBar
New Member
 
Join Date: Mar 2012
Posts: 7
YorkieBar is on a distinguished road
Default Re: Redirecting a user to a page depending on the value of an edit box

Quote:
Originally Posted by Archibald View Post
Try the version attached.

It does not work when you press the enter key.

You should be able to copy the HTML fragment, but make sure your edit box has ID of "trackBox" (without quotation marks) and that 'Write ID for this object' is set to 'Yes'. See how custom script has been applied to the button.

Do you want it to work if upper or lower case letters are entered?
Thank you!

This has helped a lot!
YorkieBar is offline   Reply With Quote
Old 16th August 2012, 10:37 AM   #6
YorkieBar
New Member
 
Join Date: Mar 2012
Posts: 7
YorkieBar is on a distinguished road
Lightbulb Re: Redirecting a user to a page depending on the value of an edit box

Hi,

Sorry for bothering you again, but could you use this method for logging into an account? If I had two fields instead of one, and if both fields matched with each other to the database, then couldn't the scripting re-direct the user to a certain page depending on what they entered?

For example, a user logs in with his/her details on the login page. If correct, the scripting redirects them to their 'page' or www.website.com/page/<user's page>.html. I think this may be possible with the exception of making their 'page' password protected so nobody else can view it without logging in first.

Would this be possible? I think this could help others as well as me if it works. On the site I am working on, users can already log in but they have to go to their specific login page to get to their account. They have to go to /login/<account_name>.html, where they log-in and are re-directed to /login/<account_name>/accounthome.html (that page being password protected). I set this up with Smart Objects/Serif Web Resources but you can't seem to apply a different re-direction URL for each login you enter so have to do it all separately (which is very frustrating!).

Thanks for all your help so far.
- YorkieBar
YorkieBar is offline   Reply With Quote
Old 16th August 2012, 11:49 AM   #7
Archibald
Master
 
Archibald's Avatar
 
Join Date: Feb 2009
Location: England
Posts: 12,833
Archibald is a splendid one to beholdArchibald is a splendid one to beholdArchibald is a splendid one to behold
Default Re: Redirecting a user to a page depending on the value of an edit box

Quote:
Originally Posted by YorkieBar View Post
If I had two fields instead of one, and if both fields matched with each other to the database, then couldn't the scripting re-direct the user to a certain page depending on what they entered?
Currently valid tracking numbers are listed in the JavaScript. You could use it for usernames instead of tracking numbers, but the list of valid usernames would be visible in the source code for the page. If you also have a field for a password and add validation check to the JavaScript, the valid passwords would be visible in the source code.

One way of doing it with JavaScript without making usernames and passwords visible would be to extend the technique in this post to allow more that one username/password combination.
__________________
Archibald
Archibald is online now   Reply With Quote
Old 16th August 2012, 02:48 PM   #8
YorkieBar
New Member
 
Join Date: Mar 2012
Posts: 7
YorkieBar is on a distinguished road
Thumbs up Re: Redirecting a user to a page depending on the value of an edit box

Quote:
Originally Posted by Archibald View Post
Currently valid tracking numbers are listed in the JavaScript. You could use it for usernames instead of tracking numbers, but the list of valid usernames would be visible in the source code for the page. If you also have a field for a password and add validation check to the JavaScript, the valid passwords would be visible in the source code.

One way of doing it with JavaScript without making usernames and passwords visible would be to extend the technique in this post to allow more that one username/password combination.
I'm sorry, but I can't figure out how to do this.

I've had a little look into that post and into the coding but, as I've said before, I know nothing about JavaScript unfortunately!

If the passwords are visible in the source code, can you make them hidden? And could you protect the page that you 'login' to or is this not possible? What I could do is put this login page on the homepage with the re-direction being to another login page (specifically created for that user) with Serif Web Resources.

If you could do what I said it would be great! If not then it doesn't matter, as I would probably be able to find another method for making login accessibility a little easier using the 'tracking number' method.

Thanks again.
- YorkieBar.
YorkieBar is offline   Reply With Quote
Old 16th August 2012, 05:23 PM   #9
Archibald
Master
 
Archibald's Avatar
 
Join Date: Feb 2009
Location: England
Posts: 12,833
Archibald is a splendid one to beholdArchibald is a splendid one to beholdArchibald is a splendid one to behold
Default Re: Redirecting a user to a page depending on the value of an edit box

Quote:
Originally Posted by YorkieBar View Post
If the passwords are visible in the source code, can you make them hidden?
The code in that other thread checks whether a password is valid without the password being visible in the JavaScript. If the password is valid, it redirects to a secret page. It would be possible to add a few lines of JavaScript so several passwords are valid, each redirecting to a different page.

Quote:
Originally Posted by YorkieBar View Post
And could you protect the page that you 'login' to or is this not possible?
Yes, that secret page could be protected using Serif Web Resources access control and a popup box should appear asking you to enter username and password. A snag with this method is that if the username or password are wrong, the site visitor ends up with a blank page.

Quote:
Originally Posted by YorkieBar View Post
What I could do is put this login page on the homepage with the re-direction being to another login page (specifically created for that user) with Serif Web Resources.
I suggest don't need to ask for both a username and password on your home page.

I suggest you stick to using the tracking number method but I would refer to it as a user's account reference or account number; not tracking number that sounds like it's for delivery of a parcel.

However, if your host supports PHP (Serif hosting doesn't), you may find Martin's method in this thread is much better.
__________________
Archibald
Archibald is online now   Reply With Quote
Old 16th August 2012, 09:14 PM   #10
YorkieBar
New Member
 
Join Date: Mar 2012
Posts: 7
YorkieBar is on a distinguished road
Smile Re: Redirecting a user to a page depending on the value of an edit box

OK, thanks for all your help.

Basically the tracking number question WAS for tracking delivery of a parcel (I sell on Amazon and am developing this tracking feature to make it easier for customers to see where their parcel is) and the login was for another website I'm in the process of creating with login features. However, I've found workarounds now so I think I'm alright!

Once again (if I've not said it enough!) thanks so much for your help! You have been a great help to me especially with the attachments!
- Yorkie Bar.
YorkieBar is offline   Reply With Quote
Old 5th December 2012, 02:45 AM   #11
somethingblue
New Member
 
Join Date: Mar 2009
Posts: 4
somethingblue is on a distinguished road
Default Re: Redirecting a user to a page depending on the value of an edit box

Hey guys! I'm trying to use the HTML and box you've both developed on here. What I want to do is make a box for customers to enter an offer code and when they enter it, it takes them to a new product page that has a different price. So basically, I just need to have the customer enter a code and it redirects to another site page. Can I do this with the Tracking number 2 file and if so, where does the page url that I want to redirect to go in the HTML?

Thanks SO much!
somethingblue is offline   Reply With Quote
Old 5th December 2012, 03:16 AM   #12
Archibald
Master
 
Archibald's Avatar
 
Join Date: Feb 2009
Location: England
Posts: 12,833
Archibald is a splendid one to beholdArchibald is a splendid one to beholdArchibald is a splendid one to behold
Default Re: Redirecting a user to a page depending on the value of an edit box

Quote:
Originally Posted by somethingblue View Post
Hey guys! I'm trying to use the HTML and box you've both developed on here. What I want to do is make a box for customers to enter an offer code and when they enter it, it takes them to a new product page that has a different price. So basically, I just need to have the customer enter a code and it redirects to another site page. Can I do this with the Tracking number 2 file and if so, where does the page url that I want to redirect to go in the HTML?
As you would not want to have the valid offer code visible in the source code, I suggest you consider using the method in the file I attached to this thread.

What if someone publishes the offer code or secret site page URL on the internet?
__________________
Archibald
Archibald is online now   Reply With Quote
Reply

Bookmarks

Tags
form, redirect, script, tracking, user

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WebPlus X5: Un wanted page redirecting. How to stop redirect? goz83 WebPlus 4 2nd January 2012 04:09 PM
WebPlus X5: Redirecting after a user log in steve53990 WebPlus 0 7th October 2011 08:41 PM
WebPlus X4: Access control/login - redirecting to next page blue-raven WebPlus 4 28th April 2011 09:15 PM
WebPlus X4: Redirecting to Thank You page from a form slipstream WebPlus 10 5th April 2010 06:47 PM
Redirecting to thank you page too quickly kathyy WebPlus 6 18th February 2009 10:34 PM


All times are GMT +1. The time now is 01:23 PM.