Addon Creation / Double Select list

Here you can find plenty of help with your general coding needs and projects
If it is about a specific program, use the corresponding forum
DO NOT ask basic questions such as "How do I print a variable", use Google for that

Addon Creation / Double Select list

Postby filunar » Fri Mar 30, 2007 8:18 pm

Dear

I am currently codding a little addon for wowroster , but I am facing a little problem. In fact I have created a From with 2 select list ( <select .... > ) as describes below

Code: Select all


    $choiceForm 
'<form action="'.$script_filename.'" method="POST" >
        <select name="Professionsfilter" '
.$wordings[$roster_conf['roster_lang']]['Professions'].'onchange="top.location.href=this.options[this.selectedIndex].value">
            <option value="'
.$script_filename.'&amp;Professionsfilter=All">'.$wordings[$roster_conf['roster_lang']]['AS_Select_Professions'].'</option>'."\n";

    while(
$row_fct $wowdb->fetch_array($result_fct))
    {
        if( 
$_REQUEST['Professionsfilter'] == $row_fct['fct_name'] )

            
$choiceForm .= '        <option value="'.$script_filename.'&amp;Professionsfilter='.$row_fct['fct_name'].'" selected="selected">'.$row_fct['fct_name']."</option>\n";
        else

            
$choiceForm .= '        <option value="'.$script_filename.'&amp;Professionsfilter='.$row_fct['fct_name'].'">'.$row_fct['fct_name']."</option>\n";
    }

    
$choiceForm .= '    </select>';

$choiceForm .= '<select name="Recipefilter" onchange="top.location.href=this.options[this.selectedIndex].value">
            <option value="'
.$script_filename.'&amp;Recipefilter=All">'.$wordings[$roster_conf['roster_lang']]['AS_Select_RecipeType'].'</option>'."\n";

    while(
$row_type $wowdb->fetch_array($result_type))
    {
        if( 
$_REQUEST['Recipefilter'] == $row_type['recipe_type'] )
            
$choiceForm .= '        <option value="'.$script_filename.'&amp;Recipefilter='.$row_type['recipe_type'].'" selected="selected">'.$row_type['recipe_type']."</option>\n";
        else
            
$choiceForm .= '        <option value="'.$script_filename.'&amp;Recipefilter='.$row_type['recipe_type'].'">'.$row_type['recipe_type']."</option>\n";
    }

    
$choiceForm .= '    </select></form><hr>';
    echo 
$choiceForm;

 


When I am selecting a value in the first select box it's ok , but when I am choosing a value in the second select box , the only value sent by the form is the value of the second select box , but not the value of the first select box

If someone has an idea it could help me , here is an example of my problem

http://eelessar.free.fr/roster/addon.php?roster_addon_name=BesoinRaid

Many thanks

I hope that I am not breaking the rule of the forum , I haven't find the exact category in order to poset this in the forum

regards

Filunar
Last edited by filunar on Fri Mar 30, 2007 8:26 pm, edited 2 times in total.
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Addon Creation / Double Select list

Postby PleegWat » Fri Mar 30, 2007 11:03 pm

The problem is that you're triggering a special event when the select box is changed. Only the value you specify is sent, rather than the whole form.
The solution is changing the onClick into something like "this.form.submit();", or having a separate submit button (<input type="submit" value="Go" />)
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Addon Creation / Double Select list

Postby filunar » Sat Mar 31, 2007 2:30 am

ok many thanks , I will try this
:thumleft:

cya
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Re: Addon Creation / Double Select list

Postby filunar » Mon Apr 02, 2007 5:31 pm

I have used a submit button and it works without any problem , many thanks.

But now I am facing a new problem , I have a <AHREF> link on my index.php page , I f you ar clicking on it is supposed to redirect to the ajout.php page

But when I am clicking on it I have the following error message " Detected invalid access to this file! "

Here is the link I am trying to reach :

[url=http://eelessar.free.fr/roster/addons/BesoinRaid/ajout.php]http://eelessar.free.fr/roster/addons/BesoinRaid/ajout.php
[/url]
I assume that the URL is not Roster friendly it's why I ca'nt acces to the file , What is the right syntax in order to allow wowroster to accept this ?

Many thanks

Regards :flower:
Last edited by filunar on Mon Apr 02, 2007 5:33 pm, edited 2 times in total.
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Addon Creation / Double Select list

Postby PleegWat » Mon Apr 02, 2007 5:52 pm

The addon framework doesn't work like that. You should put some code in index.php that includes a different page based on an url parameter.

Code: Select all
'<a href="'.ROSTER_URL.'addon.php?roster_addon_name='.$_GET['roster_addon_name'].'&amp;p=ajout">'


Then near the beginning of index, after you've loaded your own common files:
Code: Select all
switch ($_GET['p'])
{
case 'main': include 'main.php'; break;
case 'ajout': include 'ajout.php'; break;
case 'default': message_die('Invalid page'); break;
}
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Addon Creation / Double Select list

Postby filunar » Mon Apr 02, 2007 6:55 pm

Oh :scratch: ok I will try this

Many thanks for your prompt answer PleegWat

Bye :thumleft:
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Re: Addon Creation / Double Select list

Postby filunar » Tue Apr 03, 2007 2:05 am

Perfect it's work well :thumleft:

But I have another question ..... :twisted:

do you know if it's possible to use the $_REQUEST variable with a value of a form with a dynamical name :

ie:

Code: Select all

$NombreIt2 
3;
$NombreRecipeChar "NombreRecipe".$NombreIt2;
echo 
$_REQUEST[$NombreRecipeChar]; 


Many thanks

Regards

Filunar

Edit : Sorry I was having a Typo in my code it works now many thanks
Last edited by filunar on Tue Apr 03, 2007 7:34 pm, edited 3 times in total.
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Re: Addon Creation / Double Select list

Postby filunar » Fri Apr 06, 2007 4:45 pm

Hi guys

I am have a litlle question , I want to parse one variable which is containing the different receipe of a craft

ie :
Code: Select all

$ingr
="Moustache de Khadgar [x4]<br>Hivernale [x2]"
 


I want to parse this variable in order to have the following result
Code: Select all

$ingr
-name[0]="Moustache de Khadgar"
$ingr-name[1]="[x4]"
$ingr-name[2]="Hivernale"
$ingr-name[3]="[x2]"
 


Or something like that , if someone has an idea .

Many thanks

regards :thumleft:
Last edited by filunar on Fri Apr 06, 2007 4:47 pm, edited 1 time in total.
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Addon Creation / Double Select list

Postby PleegWat » Fri Apr 06, 2007 8:55 pm

Code: Select all

$ingr 
explode('<br>',$ingr);
$parts = array();
foreach(
$ingr as $i => $item)
{
$words explode(' ',$items);
$parts[$i]['amount'] = array_pop($words);
$parts[$i]['name'] = implode(' ',$words);
}
 


Or something along those lines. Untested.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Addon Creation / Double Select list

Postby filunar » Fri Apr 06, 2007 9:17 pm

Ohh Each time you are giving to me some clue to solve my problem pleegwat , many thanks for your help ;) i will test this

Regards

cya
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Re: Addon Creation / Double Select list

Postby filunar » Sat Apr 14, 2007 7:25 pm

Hi guys

I have solve most of my problem ; so ,y needin is nearly complete ; but I have a question ; is there a list somewhere which is describing the name of a item and the path of the icon associated to it ?

If not I will have to do it ; but it will be a quite big job

thanks
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Addon Creation / Double Select list

Postby PleegWat » Sat Apr 14, 2007 10:12 pm

There is no such list included in roster. However, if the item is in the roster_items table (that is, if it's an item a player is wearing, or that is in his inventory or bags), the icon is also stored in that table. There is also an icon name stored for items in the mailbox, for spells/talents, and for the products created by recipes the players know.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Addon Creation / Double Select list

Postby filunar » Sun Apr 15, 2007 12:22 am

Ok I have the answer , at the moment I am using the item texture from the roster_item table as you describe

But if an item is not own by someone in the guild it's not possible to have the missing texture.

So I wil have to add manually in a specific table the missing item texture

Thanks ;) :flower:
User avatar
filunar
WR.net Apprentice
WR.net Apprentice
 
Posts: 14
Joined: Tue Mar 27, 2007 6:44 pm

Re: Addon Creation / Double Select list

Postby Tennessee » Tue May 13, 2008 10:07 am

:thumright: i have been beatin my head for the last 2 hours tryin to get this link to anther page to work and finally found your post PleegWat works great
User avatar
Tennessee
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 54
Joined: Fri Apr 04, 2008 2:00 am


Return to General Code Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron