Page 1 of 1

Default value for FEU login and password boxes

Posted: Thu Jul 31, 2008 2:16 pm
by jwaldeck
Hello guys!

I've been trying to define a default value for the login and password boxes in the FEU login form, because i don't have enough space to show a input legend...

Tried the code:
{$startform}
{$input_username value="username"}
{$input_password value="password"} 


But it didn't work. Tried to understand how this tag builds up that login form, but that was too much for me.

What i need, as an output, is this:




Already tied the help file, other threads, the "Preferences" tab, but couldn't find the answer...

What am I missing? This might be one of those easy things i'm not finding... ???

Cheers,
jw

Re: Default value for FEU login and password boxes

Posted: Thu Jul 31, 2008 3:55 pm
by sn3p
I think you can't set values from the tag, so you need custom code for this.
But the password input won't show text because it's masked, so there's no point in doing this.

Re: Default value for FEU login and password boxes

Posted: Thu Jul 31, 2008 4:01 pm
by jwaldeck
Hi sn3p,

what do you mean with "the input it's masked"?

Take a look at this template: http://www.institutoazzi.org.br/index.php

I just need to specify a value for these two inputs. And I figured it's not possible to do it directly from the tag... Is there any other way? Even hard coding something (which i couldn't find)...

Tks.

Re: Default value for FEU login and password boxes

Posted: Thu Jul 31, 2008 9:15 pm
by Dr.CSS
I can get a word to show up in there but can't get it to go away when clicking in box...

Re: Default value for FEU login and password boxes

Posted: Thu Jul 31, 2008 9:22 pm
by jwaldeck
For this value to go away, you should add the following code after the "value":

Code: Select all

onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;
The problem might be adding this after the value inside the input tag, i know.
How did you make a word show inside the box?

Re: Default value for FEU login and password boxes

Posted: Fri Aug 01, 2008 12:15 am
by Dr.CSS
In FEU folder function.user_loginform.php line 44...

      $this->CreateInputText( $id, 'input_username', 'user',  added this, and tried the code a few ways but get smarty errors...

Re: Default value for FEU login and password boxes

Posted: Fri Aug 01, 2008 12:31 am
by jwaldeck
Uf, it almost works!!

The original output:

Code: Select all

<input type="text" name="m3feu_input_username" id="m3feu_input_username" value="" size="15" maxlength="20" />
The output after that change:

Code: Select all

<input type="text" name="m3feu_input_username" id="m3feu_input_username" value="user" size="" maxlength="15" 20/>
The script adds this strange "20/" at the end.. It pulls every data one step ahead. (maxlength was 20 and now is 15, and the "20" gets lost and remains alone at the end of the Input..)

Oh God.. Call Calguy1000!!!! :)

Tks Mark! Anyway, let me know if you figure that out... I will probably have to make some room for the labels! :(

Tks!

Re: Default value for FEU login and password boxes

Posted: Fri Aug 01, 2008 12:36 am
by Dr.CSS
Yea I know about the mess it makes, spent 45 min. trying to figure it out to no avail...

Maybe you can just put them above the boxes and put the OK button to the right, after password...

Re: Default value for FEU login and password boxes

Posted: Fri Aug 01, 2008 1:21 am
by sn3p
Hi jwaldeck,

Maybe I got you wrong.. You want the username input value set to "username" and the password input value to "password"?

What I meant with "masked" is the text in a password input is shown as asterixes (****). So if you manage to set its value, it will only show asterixes and not "password". Maybe this is ok with you, but imo this isn't a good replacement for the label.

Re: Default value for FEU login and password boxes

Posted: Fri Aug 01, 2008 2:05 am
by jwaldeck
==> Mark,

I've tried another solution, which worked.. but it's surely not the right way to accomplish that... but, yes, since "username" input has an ID (password input doesn't have one, which got me into trouble), i was able to do that:

Code: Select all

<__script__ type="text/javascript">
window.onload=function(){document.getElementById('m3feu_input_username').value='Nome de Usuário';}
</__script>
It's javascript and in sucks un most cases, i know.. But it works, at least for the username inpute...

==> sn3p,

you're right... Password input is of course masked (that didn't cross my mind 'till now)... and it doesn't have an ID, which forced me trying to use "getElementsByName", which didn't work out and i'm tired now!!  ???

Oh God, I'll probably need some room for the input legends!!! hehehhe... I'm almost giving up! ehe

Cheers guys!
jw