Hi all,
First here is the website of what I am trying to do: http://www.exmhosting. com/
Locate the login form on the top-right of the page. What I need to do is allow the user to sign into different sections of the website according to the radio button choice at login.
If the user chooses Webmail then they input their email address and password and login. If the user chooses clients they input their username and password and login.
My idea was to create 2 forms, 1 for webmail and 1 for clients and when they select a radio button the correct form is shown. If they select the other radio button the wrong form is hidden and the correct form made visible.
As you can also see I need to make this form horizontal and one 1 line, see website for example. The input box for the webmail will also need to be longer as the user inputs a full email address instead of a smaller username.
This needs to works obviously in IE as well as FF.
Thanks for any help.
4 2052 Atli 5,058
Recognized Expert Expert
Hi.
You could simply change the action property of the <form> element using the radio button's onclick event.
You could even set the width of the name text box to like that.
Hi.
You could simply change the action property of the <form> element using the radio button's onclick event.
You could even set the width of the name text box to like that.
This sounds like a good idea to me. Can you give me a few tips on how I might do this. Obviosly I will use a function to do the changes but am not quite sure how.
This is what I have come up with so far and need some help with the bits in CAPITAL letters. -
<form name='login' method='post' ACTION=''>
-
<label>webmail</label>
-
<input name='login' type='radio' value='webmail' ONCLICK='<? changeformsetting("webmail"); ?>' />
-
<label>clients</label>
-
<input name='login' type='radio' value='clients' checked='checked' ONCLICK='<? changeformsetting("clients"); ?>' />
-
<input type='text' name='user' id='loginUsername' SIZE='' VALUE='' />
-
<input type='password' name='pass' id='loginPassword' value='password' />
-
<input type='submit' value='Login' id='loginSubmit' />
-
</form>
-
-
<script language="javascript">
-
function changeformsetting(logintype) {
-
if ($logintype == "webmail") {
-
ACTION = "https://someurl.com";
-
SIZE = 20;
-
VALUE = "email address";
-
}
-
else {
-
ACTION = "/login.php";
-
SIZE = 10;
-
VALUE = "username";
-
}
-
}
-
</script>
-
Once again thanks for any help offered.
Well I have worked it out and will put my solution here for anyone else who may be in a similar dilemma.
This is the from I used: -
-
<form name='login' id='loginform' method=post action='/logmein.php'>
-
<input name='login' type='radio' value='webmail' OnClick=\"changeformsetting('webmail','loginUsername','loginform');\" id='webmail' /><label>WEBMAIL</label>
-
<input name='login' type='radio' value='clients' OnClick=\"changeformsetting('clients','loginUsername','loginform');\" id='clients' checked='checked' /><label>CLIENTS</label>
-
<input type='text' name='user' id='loginUsername' value='username' size='20' />
-
<input type='password' name='pass' id='loginPassword' value='password' size='20' />";
-
<input type='submit' value='Login' id='loginSubmit' />
-
</form>
-
and this is the function I created to do the work: -
function changeformsetting(id1,id2,id3) {
-
var el1 = id1; //radio button
-
var el2 = id2; //text input
-
var el3 = id3; //form
-
if (document.getElementById(el1).value == 'webmail') {
-
document.getElementById(el2).size = 30;
-
document.getElementById(el2).value = 'email address';
-
document.getElementById(el3).action = 'https://someurl/login/';
-
}
-
if (document.getElementById(el1).value == 'clients') {
-
document.getElementById(el2).size = 10;
-
document.getElementById(el2).value = 'username';
-
document.getElementById(el3).action = '/logmein.php';
-
}
-
}
-
I know there are probably prettier ways of doing this but at least this works thanks to the advice of Atli.
Atli 5,058
Recognized Expert Expert
Glad you found a solution!
And thank you for sharing it.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: newfie912 |
last post by:
I have an online application used for grading students. On one of the
pages, I have a table with two rows and each row has 16 cells. The
upper row contains the letter grade (A, A-, B+, B, etc) and the lower
row has a 16 radio buttons for selecting the appropriate grade. This
all writes to a SQL server back-end and has been working fine for
several semesters. Some faculty members have complained that it is
hard to read and see which...
|
by: Z.K. |
last post by:
I started a forms application and I put on the form three buttons. In
the functions for the radio buttons I put in a single messagebox like:
MessageBox("Hello 1")
MessageBox("Hello 2")
MessageBox("Hello 3")
|
by: Jeffrey Christiansen |
last post by:
I wanted to add a toggle button to a VB2005 form to be used for a
simple Windows Application (i.e. compiled to a "*.exe"), so I added
the ActiveX Microsoft Forms Object toggle button, however I can't get
this button does work properly. The documentation I found in the
FM20.CHM files says the button state can be determined from its
"Value" property, but the property list shown in VB2005 does not have
a "Value" property. How is the button...
|
by: Jeff Ciaccio |
last post by:
I would like to create a toggle button, so I chose a radio and set its
apperance to button. Is seems my method always makes this .checked = false.
Can somebody help me to see the error in my ways? I'm guessing that I just
need an event that triggers before it actually changes the value of the
button.
Private Sub radSound_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles radSound.Click
If radSound.Checked = True...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |