• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

change nick with textfield and submit button

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby baarnsma » Thu Jun 23, 2011 9:05 am

I am trying to add a form containing 1 textfield and 1 submit button to send a command to the chat to change a person's nickname.

I have tried adding the following under the smilies div in themesdefaultchat.html.tpl.php:

Code: Select all
<form name="form1" action="javascript:void(0)">
  change nick
  <input type="text" name="newnick" class="input" id="MyTextBox">
  <input type="submit" name="Submit" value="Submit" onclick="pfc.sendRequest('/nick ' + document.getElementById('MyTextBox'));">
</form>

It works only half. It *does* change the nickname, but not to the text entered in the textfield, but to "[object]"

As far as I can see, this javascript should do the trick. What am I missing?

Or is there a better way to go about this?

Thanks in advance.
baarnsma
New member
 
Posts: 2
Joined: Thu Jun 23, 2011 8:26 am
Top

Postby re*s.t.a.r.s.*2 » Thu Jun 23, 2011 2:30 pm

hi,

What you are doing its getting the ID of FORM OBJECT instead of the value of the input..


Code: Select all
<form name="form1" action="javascript:void(0)">
  change nick
  <input type="text" name="newnick" class="input" id="MyTextBox">
  <input type="submit" name="Submit" value="Submit" onclick="pfc.sendRequest('/nick ' + document.form1.newnick.value);">
</form>

But I am wandering because has a Form input that helps changing the nick , it is at the left corner where says your nick...

regards.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby baarnsma » Thu Jun 23, 2011 3:11 pm

The default nickname changing input is too much hidden; users won't know that the name is clickable.

Your code suggestion works perfectly, thank you!
Last edited by baarnsma on Thu Jun 23, 2011 3:13 pm, edited 1 time in total.
baarnsma
New member
 
Posts: 2
Joined: Thu Jun 23, 2011 8:26 am
Top


Post a reply
3 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 22 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub