Jump to content

adige72

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Posts posted by adige72

  1. This select box below does remember and highlight -one- selection after submitting the form. But when i make it multiple, it doesn't highlight any of the selections after submitting.

    Any idea about how to achieve this?

     

    Thanks in advance.

     

    <?php
    $options_amount = array("0","1","2","3","4","5","6","7","8","9","10+");
    $no_way = $_GET['no_way'];
    ?>
    
    <select class="postform" name="no_way[]" multiple size="5">
    <option <?php if ($no_way == 'all') { ?>selected="selected"<?php }?> value="all">Any</option>
    <?php
    foreach ($options_amount as $option) {
    ?><option <?php if ($no_way == $option) { ?>selected="selected"<?php }?> value="<?php echo $option; ?>"><?php echo $option; ?></option><?php }?>
    </select>
    

  2. Hello

     

    Firstly, this is the full pastebin code of my admin page because i failed adding full code here correctly: http://pastebin.com/tQAaQjYC

     

    and the screenshot of the slide manager page:

    http://img36.imageshack.us/img36/4830/slidemanager.jpg

     

     

    Well, I have a Slide Manager as an admin menu page in Wordpress. When i click "Add new slide" button, as you see in the screenshot above, it adds a new "slide field" in which that dropdown list shows all titles of posts. (Ignore other parts as they work as expected)

     

    What i would like to do is, when i choose a post title, the text box which is next to dropdown to be populated automatically by the post's url adress. I want it to be worked for every "slide field" added via "Add new slide" button.

     

    I actually made it work that way outside the foreach:

     

    <script language="JavaScript"><!--
    			function onChange() {
    				var Current = 
    				document.myform.link.selectedIndex;
    				document.myform.currentText3.value =
    				document.myform.link.options[Current].value;
    			}
    
    			//-->
    		</script>						
    
    		<select name="link" onChange="onChange(this.value);">
    		<?php
    		if($_POST['action'] == save ) {
    			$selected = "selected";
    			}
    			else{
    			$selected = "";
    			}
    			echo '<option value="">...... Choose One ...... </option>';
    			$args = array(
    			'post_type' => 'post',
    			'nopaging'  => true
    			);
    
    			$the_query = new WP_Query( $args );
    
    			while ( $the_query->have_posts() ) : $the_query->the_post();
    			echo '<option '.$selected.' value="'.get_permalink( $post->ID ).'">';
    			the_title();
    			echo '</option>';
    			endwhile;
    
    			?>
    		</select>			
    
    		<input name="currentText3" type="text" value="">

     

    But when i add this after the opening code of foreach, i.e:

     

       

    <?php foreach($nivoslides as $k => $slide) : ?>

     

    Each slide field shows the dropdown and text box properly as you see in screenshot BUT none of them work.

     

    I tried to add brackets but it didn't work either:

     

       

    <select name="link[]" onChange="onChange(this.value);">

     

    I guess it's the javascript code that should be edited or entirely changed but i have no idea how to do it.

     

    I would be grateful for any help. Thanks in advance.

  3. Below code is what i found from a search in web.

     

    Suppose i have a taxonomy called Color and terms are Blue, Green, Red, Yellow, White. I want when i select Blue, Green and Red and click submit button, i want to get ALL posts those have Blue OR Green OR Red (OR etc.) taxonomy term on the search results page.

     

    Since the code below is just echoes "Insert Query - Blue, Insert Query - Red ...", is there any way to convert this into a code that in which i can get posts?

     

    Thanks in advance.

     

     

    <?php
    if(isset($_POST['clickhere'])) {
    $selected_values = $_POST['color'];
    foreach($selected_values as $key=>$value) {
                    // Insert query comes here.
    	echo "Insert Query - ".$value."<br />";
    }
    
    $select_blue = (in_array('1',$selected_values)) ? "selected" : "";
    $select_green = (in_array('2',$selected_values)) ? "selected" : "";
    $select_red = (in_array('3',$selected_values)) ? "selected" : "";
    $select_yellow = (in_array('4',$selected_values)) ? "selected" : "";
    $select_white = (in_array('5',$selected_values)) ? "selected" : "";
    }
    ?>
    
    <form name='testform' action='sometest.php' method='post'>
    <select name='color[]' style="border:0px;" size=6 multiple>
    <option value='' selected>Select Item</option>
    <option value='1' <?php echo $select_blue;?> >Blue</option>
    <option value='2'<?php echo $select_green;?> >Green</option>
    <option value='3'<?php echo $select_red;?> >Red</option>
    <option value='4'<?php echo $select_yellow;?> >Yellow</option>
    <option value='5'<?php echo $select_white;?> >White</option>
    </select>
    <br /><br />
    <input type='submit' name='clickhere' value='Click Here' />
    </form>

  4. Hi.

     

    I would like to automatically fill in the textbox labeled "Amount 2" after choosing the value of Amount without refreshing the page. I guess it requires javascript or AJAX but i don't know how to do it. Any help please?

     

    http://i55.tinypic.com/29crpdz.jpg

     

    $options_amount = array("0","1","2","3","4","5","6","7","8","9","10+");
    
    $metabox = array();
    
    $metabox[] = array(   "name" => "amount",
                                "label" => "Amount",
                                "desc" => "Choose the amount.",
                                "std" => "0",
                                "type" => "select",
                                "options" => $options_amount);
    
    $metabox[] = array(   "name" => "amount2",
                                "label" => "Amount 2",
                                "desc" => "No need to enter it.",
                                "std" => "",
                                "type" => "text"); 
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.