Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 05 Nov 2015, 22:51
tiztoz tiztoz is offline
 
Join Date: Aug 2015
Adding comma when needed in custom profile (postbit legacy)

I have created two custom profile fields.
the first one includes 20 teams and the user can choose only one
the second has also 20 teams and the user can choose only one.


This is my code :


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.



The problem with my code is that it always puts the comma , I want it to add the comma only if the user chooses two teams ( one from each group) , while if the user chooses only one team , it does not add the comma.
Reply With Quote
  #2  
Old 06 Nov 2015, 18:34
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Do they have to choose something in each field - 11&12? Or only in one field - only in 11? Give us some of those details and then we can write up some conditions.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #3  
Old 06 Nov 2015, 18:47
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Real name: Milk Pink

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Would this not work?
Reply With Quote
  #4  
Old 06 Nov 2015, 19:13
tiztoz tiztoz is offline
 
Join Date: Aug 2015
Originally Posted by PinkMilk View Post
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Would this not work?
Works like charm
Reply With Quote
  #5  
Old 07 Nov 2015, 10:22
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Real name: Eric
Originally Posted by PinkMilk View Post
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Would this not work?
You will still get the comma if field 11 is left blank. try this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This will leave out the comma if only 1 field is selected, but show it, if both have a value.
Reply With Quote
  #6  
Old 07 Nov 2015, 18:41
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Actually, if field11 is left blank, nothing will show because of the initial condition around the whole line.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #7  
Old 07 Nov 2015, 23:01
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Real name: Eric
Originally Posted by Lynne View Post
Actually, if field11 is left blank, nothing will show because of the initial condition around the whole line.
Yep, I missed that. Here is the corrected code


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If you want to hide the entire line if neither field has a value: (not tested, but it should work)

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Thread Enhancements Showing Custom Profile Fields On Postbit And Postbit Legacy Attila M. vBulletin 3.6 Template Modifications 21 21 Jan 2013 18:47
How to: Adding Custom profile feilds to postbit. Brad vBulletin 2.x Template Modifications 24 25 Feb 2003 20:59



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 13:33.

Layout Options | Width: Wide Color: