Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 30 Apr 2016, 01:06
m0nde's Avatar
m0nde m0nde is offline
 
Join Date: Mar 2005
Checking a profile field's value and executing javascript

I've created a custom profile field with several radio buttons. Each radio button has a text value assigned to it and the user must choose a single value from this list.

I want to branch depending on the string value of this field in a template and execute a separate script based on each value.

What I've tried is:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

But all of the scripts execute at once.

Last edited by m0nde; 30 Apr 2016 at 01:52. Reason: clarification
Reply With Quote
  #2  
Old 30 Apr 2016, 02:22
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
Try changing the single = (declaring a variable) to == (comparing a variable).
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #3  
Old 30 Apr 2016, 03:35
m0nde's Avatar
m0nde m0nde is offline
 
Join Date: Mar 2005
Thank you. I'm not at all experienced in doing any of this.

--------------- Added 30 Apr 2016 at 04:11 ---------------

In the end, in addition to my error with declaring instead of comparing values, I found that I needed to use $bbuserinfo instead of $memberinfo. I still don't understand when to use which.
Reply With Quote
  #4  
Old 01 May 2016, 18:11
Scandal's Avatar
Scandal Scandal is offline
 
Join Date: Dec 2005
Real name: Peter
Originally Posted by m0nde View Post
Thank you. I'm not at all experienced in doing any of this.

--------------- Added 30 Apr 2016 at 04:11 ---------------

In the end, in addition to my error with declaring instead of comparing values, I found that I needed to use $bbuserinfo instead of $memberinfo. I still don't understand when to use which.
You should use $bbuserinfo for the user who load the page.
If you need to apply code for the user of an item (for example on the postbit/postbit_legacy), you could use $post['fieldX'] (= it will return the fieldX value for the user of the post).
Reply With Quote
Reply


Tags
conditional, custom field, javascript, vbulletin 4


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 10:58.

Layout Options | Width: Wide Color: