Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    79
    Thanks
    7
    Thanked 0 Times in 0 Posts

    newbie help on refreshing page after selection from dropdown

    PHP Code:
    <?php echo $form['catcher_id']; //gives me the dropdown list
                  
    $catcher_names =  explode(" ",$form['catcher_id']);          
                  foreach(
    $catcher_names as $val)
                  {
                      if (
    $val == "zed-catcher") [COLOR="Red"]//not doing if cos page not refreshed with newley selected value[/COLOR]
                      
    {
                          echo 
    $form['service_code']->renderLabel();
                          echo 
    $form['service_code']->renderError();
                          echo 
    $form['service_code'];
                      }
                  }
              
    ?>
    from what i know i have to refresh the page with the newley selected value and the check it...and how to go about this i need to use AJAX and or javascript

    i am reading up on it cos i am newbie at all of this...

    anybody to help me start on this/point me in the right direction/ explain what needs to be done please??? i dont know where to begin

    many thanks!

  • #2
    New to the CF scene
    Join Date
    Jan 2011
    Location
    Queensland Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could use the onChange event to trigger a refresh;

    e.g in your forms <select onChange="javascript:location.reload(true)">

    or you could use simple javascript to change the colour of the selected option, I don't know if you want the selected background or selected text red so both options are below

    To change background colour
    ======================
    <select onChange="javascript:this.options[this.options.selectedIndex].style.background = 'red';">

    To change selected Text colour
    ========================
    <select onChange="javascript:this.options[this.options.selectedIndex].style.color = 'red';">

    This might help, but it does have it's limitations!


  •  

    Posting Permissions

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