Checkbox groups in asp - asp-classic

I ran into a strange problem with checkbox groups. I am trying to get the values from a group of checkboxes, but I have to hit the submit button twice for it to get the values... I have no idea why. I also use a dropdown box on the same form and I only need to hit the button once to get its value.
my asp code to write it to page
Dim selectFormValue
selectFormValue = Replace(Request.Form("selectTest"), """", "")
Response.write Request.Form("checkGroup")
here is the html being generated
<form method="post" name="formTest">
<select name="selectTest">
<option value='123"' selected="">Option 1</option>
<option value='124"' selected="">Option 2</option>
<option value='125"' selected="">Option 3</option>
</select>
<input type="checkbox" name="checkGroup" value="1" CHECKED />
<input type="checkbox" name="checkGroup" value="2" CHECKED />
<input type="checkbox" name="checkGroup" value="3" CHECKED />
<input type="checkbox" name="checkGroup" value="4" CHECKED />
<input type="submit" name="submit" value="Update" />
</form>
Thanks!

One thing i note is, that you don't specify an action in your form.

Related

form:select incorrectly rendering as multiple="multiple"

I have a select box that is showing up as a multi-select box when I want it to be a drop down. I cannot figure out how to change it.
<form:select path="roles" id="role" cssClass="form-control">
<form:options items="${roles}" itemLabel="description" itemValue="id"/></form:select>
The html that is produced as a result of this (see below) has the multiple box attribute added.
<select id="role" name="roles" class="form-control" multiple="multiple">
<option value="1">Administrator</option>
</select>
<input type="hidden" name="_roles" value="1"/>
It also produces that hidden input and I don't understand why.
Any help would be appreciated.

submit button in the middle of form

My question is:
May I put submit button not in the end of form, I need to put submit somewhere in the middle of form for comfort design layout.
For example:
<form name="wide-search" action="/wide-search/" method="get" class="form-wide-search">
<select class="form-control cars">
<option>1</option>
<option>2</option>
</select>
<input type="text" class="form-control" placeholder="Поиск по всем объявлениям доски">
<select class="form-control region-search">
<option>1</option>
<option>2</option>
</select>
//HERE IS FORM SUBMIT BUTTON
<div class="input-group">
<input class="form-control" id="searchInput" type="text" name="q" placeholder="Искать среди всех товаров и услуг" value="" x-webkit-speech="">
<div class="input-group-btn">
<button type="submit" class="btn btn-primary">Найти</button>
</div>
</div>
//AND THEN WE HAVE SOME SELECT'S WITH PARAMETRES, THAT ALSO CONNECTED TO THIS FORM BUT THEIR
PLACE IS AFTER SUBMIT BUTTON
<select class="form-control mark">
<option>1</option>
<option>2</option>
</select>
<select class="form-control model">
<option>1</option>
<option>2</option>
</select>
<select class="form-control year">
<option>1</option>
<option>2</option>
</select>
</form>
I need to create Html and Css design layout for this form, I get this task from programmer, and I'm not shur will this work true, or it is wrong layout. I didn't find answer in internet for this question. So I believe someone can explain me. In the end I add image of this form.
You can put the submit button anywhere inside the form. Also with the HTML5 form attribute you don't even have to put it inside the form, e.g.
<form id="form-id">
...
</form>
<button type="submit" form="form-id">Submit from outside</button>
The location for where you place elements inside a form does not matter. A quick example would be:
Submit Button On Top of Input
Also, a submit button can be located outside the form with the the form attribute and the form's id.
Submit Outside Form

Changing WordPress form redirect URL based on options chosen?

I am creating a simple WordPress website, similar to this one: http://viewsyoutubes.com/
I need a form inserted, that when completed, will send the visitor to the PayPal payment page (so when the form is submitted, it redirects the visitor to the payment page URL).
However, I don't know how to make it so that depending on the option they have chosen, it sends them to a different payment page (there are different prices for different products - so when a product is selected, it needs to redirect the visitor to the corresponding payment page). It needs to be something like this:
http://viewsyoutubes.com/buy-youtube-views/
When a different package is selected, it sends you to a different payment page.
This is the site at the moment, as you can see there are 20 options in the drop down list, and i need the submit URL to change corresponding to the item that was chosen.
Thanks.
medialads.tk/youtube-views-likes/
You mean something like this?
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="Your#email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Shopping Cart">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<input type="hidden" name="on0" value="Sizes"><select name="os0">
<option value="Small">Small $5.00 USD</option>
<option value="Med">Med $7.00 USD</option>
<option value="Larg">Larg $10.00 USD</option>
<option value="Super Size">Super Size $15.00 USD</option>
</select>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="option_select0" value="Small">
<input type="hidden" name="option_amount0" value="5.00">
<input type="hidden" name="option_select1" value="Med">
<input type="hidden" name="option_amount1" value="7.00">
<input type="hidden" name="option_select2" value="Larg">
<input type="hidden" name="option_amount2" value="10.00">
<input type="hidden" name="option_select3" value="Super Size">
<input type="hidden" name="option_amount3" value="15.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

define which fields to search from admin panel in wordpress

In my wordpress site, when i use the search it searches all the fields of the post.
I am looking for a way to define which fields it will look for from the default search of wordpress.
there are many manuals on creating your own custom search, but i am looking to make changes from dashboard or from search.php
any suggestions?
Here is the example :
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value="Enter keywords ..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/><br />
<select name="post_type">
<option value="">Choose Category:</option>
<option value="">All Categories</option>
<option value="post_type_a">Post Type A</option>
<option value="post_type_b">Post Type B</option>
<option value="post_type_c">Post Type C</option>
</select><br />
<input type="submit" id="searchsubmit" value="Search Help" />
</form>
If you dont want to show the custom post types in drop down you can assign the values in hiden fields also, something like below.
<input type="hidden" name="post_type[]" value="post_type_one" />
<input type="hidden" name="post_type[]" value="post_type_two" />
<input type="hidden" name="post_type[]" value="post_type_three" />

Get the selected input type radio button ASP.NET

I have two radio buttons:
<input type="radio" name="group1" />1
<input type="radio" name="group1" />2
How do I know which one is selected when the form is posted?
The inputs should have values:
<input type="radio" name="group1" value="1" />1
<input type="radio" name="group1" value="2" />2
Then, the value will be posted on the name group1. On Asp.net you can get it using:
Request.Form["group1"]
If you are using runat="server", it can happen that name attribute is changed at client, so you will get null as value.

Resources