Radio Streaming - 50% Lifetime Discount with purchase of any Joomla Web Radio Addon. Discount Code: STR15-Z
See Radio Streaming Plans

Results 1 to 7 of 7

Thread: Prediction score insert

  1. #1

    Lightbulb Prediction score insert

    Hi,

    I have had a few requests from user on our site to see if it's possible to change the prediction page.
    At the moment users put their prediction into a text box, could this be changed to possibly a drop box showing possible score, 1, 2, 3, 4 etc instead. Users then click on a score for that team.
    It was mentioned to me as a few users play on their phones and have to keep changing from Alpha to Numeric for each insert.
    Hope this makes sense.
    Regards

  2. #2
    Administrator
    Join Date
    Jul 2015
    Posts
    65
    Hello,

    to change the textbox to dropdown change the code in file <joomla directory>/components/com_masterleaguepro/views/matches/tmpl/default.php

    lines 56~58

    Code:
    <td><?php
    					echo "<input type='text' name='jform[home_team_score][".$match->match_id."]' value='".$match->home_prediction."' min='0'/> - <input type='text' value='".$match->away_prediction."' name='jform[away_team_score][".$match->match_id."]' min=0 />";
    				?></td>
    to

    Code:
    <td>
    	<select name='jform[home_team_score][<?php echo $match->match_id;?>]' style='max-width: 110px;'>
    		<option value=''>Select Score</option>
    		<?php for($sc=0;$sc<=20;$sc++): ?>
    			<option value='<?php echo $sc; ?>'<?php echo $sc==$match->home_prediction?" selected='selected'":""; ?>><?php echo $sc; ?></option>
    		<?php endfor;?>
    	</select>
    
    
    	-
    
    
    	<select name='jform[away_team_score][<?php echo $match->match_id;?>]'  style='max-width: 110px;'>
    		<option value=''>Select Score</option>
    		<?php for($sc=0;$sc<=20;$sc++): ?>
    			<option value='<?php echo $sc; ?>'<?php echo $sc==$match->away_prediction?" selected='selected'":""; ?>><?php echo $sc; ?></option>
    		<?php endfor;?>
    	</select>
    </td>
    this code will display instead of text fields a drop down with options from 0 to 20

    Best Regards

  3. #3
    many thanks, have changed the code and works great for the league. 20 was too many so changed to 9.
    Will this have changed the code for the championship also ? we do not have championship games due for a while so cannot check. If it does not change the championship also, which file do I need to change and is it the same code ?
    Regards

  4. #4
    Administrator
    Join Date
    Jul 2015
    Posts
    65
    to have the same functionality in the championship you will have to change code in another file (same change)
    <joomla-installation>/components/com_masterleaguepro/views/minileaguematches/tmpl/default.php

    lines 57~59
    Code:
    <td><?php
    	echo "<input type='text' name='jform[home_team_score][".$match->match_id."]' value='".$match->home_prediction."' min='0'/> - <input type='text' value='".$match->away_prediction."' name='jform[away_team_score][".$match->match_id."]' min=0 />";
    ?></td>
    to

    Code:
    <td>
    	<select name='jform[home_team_score][<?php echo $match->match_id;?>]' style='max-width: 110px;'>
    		<option value=''>Select Score</option>
    		<?php for($sc=0;$sc<=20;$sc++): ?>
    			<option value='<?php echo $sc; ?>'<?php echo $sc==$match->home_prediction?" selected='selected'":""; ?>><?php echo $sc; ?></option>
    		<?php endfor;?>
    	</select>
    
    
    
    
    	-
    
    
    
    
    	<select name='jform[away_team_score][<?php echo $match->match_id;?>]'  style='max-width: 110px;'>
    		<option value=''>Select Score</option>
    		<?php for($sc=0;$sc<=20;$sc++): ?>
    			<option value='<?php echo $sc; ?>'<?php echo $sc==$match->away_prediction?" selected='selected'":""; ?>><?php echo $sc; ?></option>
    		<?php endfor;?>
    	</select>
    </td>

  5. #5
    How do we change the drop down box to show Select Score as default and not 0, this way user will see which scores still need predicting, regards

  6. #6
    Hi, just wondered if you have a resolve for the last post please, regards, steve

  7. #7
    Administrator
    Join Date
    Jul 2015
    Posts
    65
    Hello,

    to make the default value "Select Score"

    change the code from
    Code:
    <td>
        <select name='jform[home_team_score][<?php echo $match->match_id;?>]' style='max-width: 110px;'>
            <option value=''>Select Score</option>
            <?php for($sc=0;$sc<=20;$sc++): ?>
                <option value='<?php echo $sc; ?>'<?php echo $sc==$match->home_prediction?" selected='selected'":""; ?>><?php echo $sc; ?></option>
            <?php endfor;?>
        </select>
        -
        <select name='jform[away_team_score][<?php echo $match->match_id;?>]'  style='max-width: 110px;'>
            <option value=''>Select Score</option>
            <?php for($sc=0;$sc<=20;$sc++): ?>
                <option value='<?php echo $sc; ?>'<?php echo $sc==$match->away_prediction?" selected='selected'":""; ?>><?php echo $sc; ?></option>
            <?php endfor;?>
        </select>
    </td>
    to

    Code:
    <td>
    	<select name='jform[home_team_score][<?php echo $match->match_id;?>]' style='max-width: 110px;'>
    		<option value=''>Select Score</option>
    		<?php for($sc=0;$sc<=20;$sc++): ?>
    			<option value='<?php echo $sc; ?>'<?php echo $sc==$match->home_prediction&&$match->home_prediction!=""?" selected='selected'":""; ?>><?php echo $sc; ?></option>
    		<?php endfor;?>
    	</select>
    	-
    	<select name='jform[away_team_score][<?php echo $match->match_id;?>]'  style='max-width: 110px;'>
    		<option value=''>Select Score</option>
    		<?php for($sc=0;$sc<=20;$sc++): ?>
    			<option value='<?php echo $sc; ?>'<?php echo $sc==$match->away_prediction&&$match->away_prediction!=""?" selected='selected'":""; ?>><?php echo $sc; ?></option>
    		<?php endfor;?>
    	</select>
    </td>
    Best Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •