svn[1329] Settings not saving w/ Addon

Posts from previous Beta sessions

svn[1329] Settings not saving w/ Addon

Postby boyo » Sun Sep 16, 2007 1:54 pm

First off, this is the first addon that I am trying to write.
With that out of the way, In my settings, I needed a dynamic menu option, to select which guild the addon would apply to. I created the /admin/conf.func.php with the function in it, it reads the database just fine, it shows the dropdown list just fine, but it wont save the option.

I've created html forms hundreds of times, so I'm pretty sure that the format for that is correct, i've done php enough to know what i'm doing to an extent. i've viewed the source from the main page and everything looks the same. I've opened roster/admin/roster_config_functions.php and looked at the pageNames() function and based my function off of that, but again, it still does not update. I always get "No changes have been made"

Any insite to this would be helpful. I cant tell if it's a bug in the roster, or if i'm really fubaring something. Here is my function, in case it's something in it.

Code: Select all
function GetGuildList(){
   global $roster;
   global $addon;
   
   $query = "SELECT * FROM {$roster->db->prefix}guild ORDER BY `guild_id` ASC";
   $result = $roster->db->query( $query );

   $return = '<select name="choose_guild">';
   if ($addon['config']['choose_guild'] == 0){
      $return .= '<option value="0" selected="selected">-[ Disabled ]-</option>';
   }else{
      $return .= '<option value="0">Disabled</option>';
   }
   
   while ($row = $roster->db->fetch( $result ) ){
      if ($row['guild_id'] == $addon['config']['choose_guild']){
         $return .= '<option value="'. $row['guild_id'].'" selected="selected">-[ '.$row['guild_name'].']-</option>';
      }else{
         $return .= '<option value="' . $row['guild_id'] . '">' . $row['guild_name'] . '</option>';
      }

   }
   $return .= "</select>";
   $roster->db->free_result($result);
   return $return;
}


Edit: updated code.
Last edited by boyo on Sun Sep 16, 2007 2:09 pm, edited 1 time in total.
boyo
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 103
Joined: Wed Jan 24, 2007 7:37 am

svn[1329] Settings not saving w/ Addon

Postby zanix » Sun Sep 16, 2007 3:46 pm

I think config_ needs to be appended to the name of the select element
Code: Select all
$return = '<select name="config_choose_guild">';

I think this it is this way because there was a weird error in IE with tooltips not displaying, we found out the the name of each field was causing them not to work
So we appended 'config_' to each name attribute
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: svn[1329] Settings not saving w/ Addon

Postby boyo » Sun Sep 16, 2007 4:36 pm

Wow, that worked. That's enough to cause a headache. lol.
However, I have to add, after playing with it for a little bit;
I had to change the <select> and that was it.
I tried to follow the 'normal' naming conventions and changed every reference from choose_guild to config_choose_guild, and that caused headaches.

I changed only the <select> tag, and it worked fine.

This might be valuable information to add to the wiki.

.. which i think i've read the whole thing by now, lol.

Edit: It should also be noted, this only applies when using a function.
Last edited by boyo on Sun Sep 16, 2007 4:39 pm, edited 1 time in total.
boyo
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 103
Joined: Wed Jan 24, 2007 7:37 am


Return to Archived

Who is online

Users browsing this forum: No registered users and 1 guest

cron