I have this code and can't figure out what seems to be the problem: if i select 1 & 2, 1 & 3 it's working.
But if I select 2 or 3 only then it's not working.
What seems to be the problem?
I would like to select multiple at the same time.
i think I need to put some if and else here?
But don't really know and sure how?
This is the code:
<div style="background-color:#CCDFED">
<form method="post" action="[~[*id*]~]">
<input type="hidden" name="formid" value="registrationForm" />
<table>
<tr>
<td>
<label for="termine" style="margin:0.5em">Termine:</label>
<td>
<td>
<input type="checkbox" name="termine1" value="Montag 4. Oktober 2010" eform="Termine::1"/> Montag 4. Oktober 2010 <br/>
<input type="checkbox" name="termine2" value="Mittwoch 13. Oktober 2010" /> Mittwoch 13. Oktober 2010 <br/>
<input type="checkbox" name="termine3" value="Freitag 22. Oktober 2010" /> Freitag 22. Oktober 2010 <br/>
</td>
</tr>
<tr>
<td><label for="email" style="margin:0.5em">Email:</label></td>
<td><input type="text" name="email" size="60" maxlength="60" eform="Email:email:1" /><td>
</tr>
<tr>
<td>
<label style="margin:0.5em; display:block" for="kopieren" >Bitte kopieren Sie den Anti-Spam Code ein: </label>
<img src="[+verimageurl+]" alt="verification code" border="1" style="margin:0.5em"/></td>
</td>
<td valign="top"><input type="text" name="vericode" size="20" /> </td>
</tr>
<tr>
<td rowspan="3" valign="right">
<input align="right" type="submit" name="submit" style="margin:0.5em" value="Register" />
</td>
</tr>
</table>
</form>
</div>
You are making them required by setting eform on all of them. Remove the ::1 eform if they are not required. I also added a validation message.
Try:
<input type="checkbox" id="termine1" name="termine[]" value="Montag 4. Oktober 2010" eform="Termine::1:Please select at least one box"/> Montag 4. Oktober 2010 <br/>
<input type="checkbox" id="termine2" name="termine[]" value="Mittwoch 13. Oktober 2010" /> Mittwoch 13. Oktober 2010 <br/>
<input type="checkbox" id="termine3" name="termine[]" value="Freitag 22. Oktober 2010" /> Freitag 22. Oktober 2010 <br/>
I am doing all of this blindly, so bear with me. Once you have submitted the form, you now need I no longer see your code for the confirmation page. All you need to change is in your report you need to use
[+termine+].
This might because of label is not attaching with your, checkbox, just provide Id to checkbox, please refer below
<input type="checkbox" id="termine1" name="termine1" value="Montag 4. Oktober 2010" eform="Termine::1" />
<label for="termine1"> Montag 4. Oktober 2010</label>
Hope this will resolve your issue.
Related
I'm trying to get a form to output a number value based on the outcome of two fields. A value input and a radio selection but I can't seem to get it to work.
<form oninput="retVal.value=parseInt(pavVal.value)-(parseInt(pavVal.value)*parseInt(pavCAT.value))">
<table>
<tr>
<td>
<label for="pavVal"><b>PAV:</b></label>
</td>
<td>
<input type="number" id="pavVal">
</td>
</tr>
<tr>
<td>
<label for="pavCAT" ><b>CAT:</b></label>
<td>
<input type="checkbox" name="pavCAT" id="pavCAT" value="0.3">
<label for="0.3" > N (30%)</label>
<input type="checkbox" name="pavCAT" id="pavCAT" value="0.2">
<label for="0.2" > S (20%)</label>
<input type="checkbox" name="pavCAT" id="pavCAT" value="0.1">
<label for="0.1"> B (10%)</label>
</td>
</tr>
<tr>
<td>
<label for="retVal"><b>Retention Value:</b></label>
</td>
<td>
<output name="retVal" for="pavVal pavCAT"></output>
</td>
</tr>
</table>
</form>
Anyone able to tell me where I'm going wrong>
Ids must be unique -- there were three #pavCAT. When the browser is told to do anything with #pavCAT, it will find the first #pavCAT do whatever it was supposed to do then quit, leaving the other 2 #pavCATs untouched as if they never existed. The easiest solution is to suffix each id with a number.
The rest of the code should work since in this case the id #pavCAT is just as accessible as the name [name="pavCAT"].
Also, the HTML had checkmarks not radios.
The inline event handler is now streamlined:
oninput = "retVal.value = pavVal.value - (pavVal.value * pavCAT.value)"
Note that parseInt() isn't used to convert the string values into numbers. That's because the strings are being coerced into numbers by the use of these operators: - and *.
<form id='calc' oninput = "retVal.value = pavVal.value - (pavVal.value * pavCAT.value)">
<table>
<tr>
<td>
<label for="pavVal"><b>PAV:</b></label>
</td>
<td>
<input id="pavVal" type="number">
</td>
</tr>
<tr>
<td>
<label for="pavCAT"><b>CAT:</b></label>
</td>
<td>
<input id="pavCAT3" name="pavCAT" type="radio" value="0.3">
<label for="pavCAT3"> N (30%)</label>
<input id="pavCAT2" name="pavCAT" type="radio" value="0.2">
<label for="pavCAT2"> S (20%)</label>
<input id="pavCAT1" name="pavCAT" type="radio" value="0.1">
<label for="pavCAT1"> B (10%)</label>
</td>
</tr>
<tr>
<td>
<label for="retVal"><b>Retention Value:</b></label>
</td>
<td>
<output name="retVal" for="pavVal pavCAT"></output>
</td>
</tr>
</table>
</form>
Your formula is working, but you assigned the same ID for the pavCat checkbox elements, thus returning NaN and not the correctly assigned value - try it yourself with removing/commenting out two ot the pavCAT elements.
imho is a checkbox the wrong UI element - go for a single select dropdown or even better a radio input.
Also parseInt should be parseFloat instead for pavCat. Anyways it's a little bit over the top in this situation and you could totally remove it in this simple example - maybe you have more context to justify parsing it.
<input type="radio" id="pavCat1" name="pavCAT" value="0.3">
<label for="0.3" > N (30%)</label>
<input type="radio" id="pavCat2" name="pavCAT" value="0.2">
<label for="0.2" > S (20%)</label>
<input type="radio" id="pavCat3" name="pavCAT" value="0.1">
<label for="0.1"> B (10%)</label>
https://jsfiddle.net/p9v1f53w/16/
I would like to extract from a webpage some data with VBA.
This is an invoicing program and I am trying to access the first line of data which is the product description
I am not an expert is these matters, but I looked into the html code being one of the fields of data and it looks like this:
<td class="">
<div class="UITextbox length length_maximum-255" data-tag="product_code" data-ui-widget="UITextbox"><span class="field"><input autocomplete="off" id="sales_invoice_line_items_attributes_0_product_code" name="sales_invoice[line_items_attributes][0][product_code]" readonly="readonly" size="30" type="text" /></span></div>
</td>
<td class="">
<div class="UITextbox presence length length_maximum-200" data-tag="description" data-ui-widget="UITextbox"><span class="field"><input autocomplete="off" id="sales_invoice_line_items_attributes_0_description" name="sales_invoice[line_items_attributes][0][description]" size="30" type="text" /></span></div>
</td>
<td class="hidden numeric">
<div class="UIHiddenField" data-tag="item_id" data-ui-widget="UIHiddenField"><input autocomplete="off" id="sales_invoice_line_items_attributes_0_item_id" label="false" name="sales_invoice[line_items_attributes][0][item_id]" type="hidden" /></div>
</td>
<td class="numeric">
<div class="UIDecimal presence numericality numericality_greater_than_or_equal_to-0 ensurenotgreaterthanmaxnumber ensurenotgreaterthanmaxnumber_maximum-99999999" data-tag="quantity" data-ui-widget="UIDecimal"><span class="field"><input class="hidden" name="sales_invoice[line_items_attributes][0][quantity]" type="hidden" value="0.00" /><input autocomplete="off" class="visible" data-scale="2" id="sales_invoice_line_items_attributes_0_quantity" name="" size="30" type="text" value="0,00" /></span></div>
</td>
<td class="">
<div class="UIDropdown" data-tag="unit_type" data-ui-widget="UIDropdown">
<span class="field"><select autocomplete="off" id="sales_invoice_line_items_attributes_0_unit_type" name="sales_invoice[line_items_attributes][0][unit_type]">
I tried this so far with no results:
Dim desc as string
desc = ie.Document.getElementsByClassName("UITextbox presence length length_maximum-200")(0).innerText
The following code has no errors, but no value either.
There isnt any Text in the Div you are looking at:
<div class="UITextbox presence length length_maximum-200" data-tag="description" data-ui-widget="UITextbox">
<span class="field">
<input autocomplete="off" id="sales_invoice_line_items_attributes_0_description" name="sales_invoice[line_items_attributes][0][description]" size="30" type="text" />
</span>
</div>
But the Input has an ID that you can use to get the value from
desc = ie.Document.getElementByID("sales_invoice_line_items_attributes_0_description").value
Perhaps this is not the most eficient way, but I couldnt find any other way, so I just used sendkeys to simulate the keypress that adds a new record, since I could not have the fire event to work.
Thanks for your help Ricardo
IE.Document.getElementById("sales_invoice_line_items_attributes _0_description").Value ="LINE 1 DESCRIPTION"
SendKeys "-"
SendKeys "{ENTER}"
IE.Document.getElementById("sales_invoice_line_items_attributes_1_description").Value ="LINE 2 DESCRIPTION"
I need to create 210 checkboxes each with unique names, id's and label for values.
The checkboxes reside in tables, where there are 6 checkboxes to a table.
I've manually done this for 54 checkboxes (9 tables), and want to automate the creation of the last 156 checkboxes (26 tables).
I therefore want to automate the incrementation of:
name
id
label for value
This is the simplest way I can see to do it:
Create the base structure for 26 tables (see below).
Use the Text Pastry plugin for Sublime Text.
Use a variant of this example:
https://github.com/duydao/Text-Pastry/wiki/Examples#insert-nums-syntax
With the instructions to:
Find "checkbox00"
Replace with "checkbox55"
Do this for 3 instances
Increment the number used in the replacement text and repeat for the remaining instances.
Is this the sort of thing that Text Pastry was designed to do?
If so, and it's not too large a task to explain, specific directions would be appreciated.
<!-- BEGIN table 10 -->
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox" />
<label for="checkbox00" class="css-label">custom_text_A</label>
</td>
</tr>
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox"/>
<label for="checkbox00" class="css-label">custom_text_B</label>
</td>
</tr>
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox" />
<label for="checkbox00" class="css-label">custom_text_C</label>
</td>
</tr>
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox" />
<label for="checkbox00" class="css-label">custom_text_D</label>
</td>
</tr>
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox"/>
<label for="checkbox00" class="css-label">custom_text_E</label>
</td>
</tr>
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox" />
<label for="checkbox00" class="css-label">custom_text_F</label>
</td>
</tr>
<!-- END table 10 -->
<!-- BEGIN table 11 -->
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox" />
<label for="checkbox00" class="css-label">custom_text_A</label>
</td>
</tr>
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox00" id="checkbox00" class="css-checkbox"/>
<label for="checkbox00" class="css-label">custom_text_B</label>
</td>
</tr>
<!-- ... etc, continue for 26 tables -->
Update/Solution
Here's a Python script I put together quickly that seems to do what I want it to do:
my_string = "<tr><td class=\"area_checkbox\"> \
<input type=\"checkbox\" name=\"checkbox00\" id=\"checkbox00\" class=\"css-checkbox\" /> \
<label for=\"checkbox00\" class=\"css-label\">custom_text_00</label> \
</td></tr>"
growing_string = ""
cb_suffix = 55
text_suffix = 1
for i in range(156):
if text_suffix <= 6:
temp_string = my_string.replace("checkbox00", "checkbox" + str(cb_suffix),3)
temp_string_2 = temp_string.replace("custom_text_00", "custom_text_0" + str(text_suffix))
growing_string += temp_string_2
cb_suffix += 1
text_suffix += 1
else:
text_suffix = 1
temp_string = my_string.replace("checkbox00", "checkbox" + str(cb_suffix),3)
temp_string_2 = temp_string.replace("custom_text_00", "custom_text_0" + str(text_suffix))
growing_string += temp_string_2
cb_suffix += 1
text_suffix += 1
print growing_string
Then I copied the output to JSFiddle and clicked TidyUp to format it :).
Sample Output:
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox55" id="checkbox55" class="css-checkbox" />
<label for="checkbox55" class="css-label">custom_text_01</label>
</td>
</tr>
<tr>
<td class="area_checkbox">
<input type="checkbox" name="checkbox56" id="checkbox56" class="css-checkbox" />
<label for="checkbox56" class="css-label">custom_text_02</label>
</td>
</tr>
I have a table containing soil analysis, around 400k rows, with about 30 columns. All rows have a Year column, where it says something between 1997 and 2014.
I let the user do a MySQL query based on a couple of HTML-forms and one checkbox for each year.
If no checkbox is filled it searches through every year in the table.
My intention is to let the user be able to select a specific year or several with the help of the checkboxes.
I have copied what i have right now. (I've excluded the variables and stuff, excuse the swedish here and there)
The HTML-forms work fine. But i haven't figured how to take use of the checkboxes yet. I have no idea how to implement them in the MySQL query. I've tried googling but the question seems kinda specific in my case.
I'd be really happy to hear your opinion in the matter.
<form id="form" action="statisticsToMap.php" method="post">
<p>______Minimum_____________Maximum______</p>
<p>pH: <input type="text" name="min-ph" onkeypress="return isNumberKey(event)"> pH: <input type="text" name="max-ph" onkeypress="return isNumberKey(event)"></p>
<p>P-AL: <input type="text" name="min-p" onkeypress="return isNumberKey(event)"> P-AL: <input type="text" name="max-p" onkeypress="return isNumberKey(event)"></p>
<p>K-AL: <input type="text" name="min-k" onkeypress="return isNumberKey(event)"> K-AL: <input type="text" name="max-k" onkeypress="return isNumberKey(event)"></p>
<p>Mg-AL: <input type="text" name="min-mg" onkeypress="return isNumberKey(event)"> Mg-AL: <input type="text" name="max-mg" onkeypress="return isNumberKey(event)"></p>
<p>Lerhalt: <input type="text" name="min-ler" onkeypress="return isNumberKey(event)"> Lerhalt: <input type="text" name="max-ler" onkeypress="return isNumberKey(event)"></p>
<p>Sand-Grovmo: <input type="text" name="min-sgrovmo" onkeypress="return isNumberKey(event)"> Sand-Grovmo: <input type="text" name="max-sgrovmo" onkeypress="return isNumberKey(event)"></p>
<p>Mullhalt: <input type="text" name="min-mull" onkeypress="return isNumberKey(event)"> Mullhalt: <input type="text" name="max-mull" onkeypress="return isNumberKey(event)"></p>
<p>Klicka i vilka årtal som du vill söka efter: (tomma rutor söker alla årtal)</p>
<input type="checkbox" name="1997" value="1997"> 1997
<input type="checkbox" name="1998" value="1998"> 1998
<input type="checkbox" name="1999" value="1999"> 1999
<input type="checkbox" name="2000" value="2000"> 2000
<input type="checkbox" name="2001" value="2001"> 2001<br>
<input type="checkbox" name="2002" value="2002"> 2002
<input type="checkbox" name="2003" value="2003"> 2003
<input type="checkbox" name="2004" value="2004"> 2004
<input type="checkbox" name="2005" value="2005"> 2005
<input type="checkbox" name="2006" value="2006"> 2006<br>
<input type="checkbox" name="2007" value="2007"> 2007
<input type="checkbox" name="2008" value="2008"> 2008
<input type="checkbox" name="2009" value="2009"> 2009
<input type="checkbox" name="2010" value="2010"> 2010
<input type="checkbox" name="2011" value="2011"> 2011<br>
<input type="checkbox" name="2012" value="2012"> 2012
<input type="checkbox" name="2013" value="2013"> 2013
<input type="checkbox" name="2014" value="2014"> 2014
<input type="checkbox" name="2015" value="2015"> 2015
<input type="checkbox" name="2016" value="2016"> 2016<br>
<p>Begränsa antal resultat:</p> <input type="text" name="limitrows" onkeypress="return isNumberKey(event)"> (Standard är 2000 rader)<br><br>
<table>
<tr>
<input type="submit" value="Sök i databas"onclick="submitForm('')">
<input type="submit" value="Visa resultat på karta" onclick="submitForm('statisticsToMap.php')">
</form>
</tr>
</table>
$sql = "SELECT `kundnr`, `Year`, `Provnr`, `pH`, `P_AL`, `P_HCl`, `K_AL`, `K_HCl`, `Mg_AL`,
`Cu_HCl`, `K_Mg_kvot`, `Bor`, `Ca_AL`, `Total_lerhalt`, `Sand_grovmo`, `Mullhalt`
FROM `analyser`
WHERE
(IFNULL(`pH`, '0') BETWEEN $minph AND $maxph)
AND (IFNULL(`P_AL`, '0') BETWEEN $minpal AND $maxpal)
AND (IFNULL(`K_AL`, '0') BETWEEN $minkal AND $maxkal)
AND (IFNULL(`Mg_AL`, '0') BETWEEN $minmg AND $maxmg)
AND (IFNULL(`Total_lerhalt`, '0') BETWEEN $minler AND $maxler)
AND (IFNULL(`Mullhalt`, '0') BETWEEN $minmull AND $maxmull)
AND (IFNULL(`Sand_grovmo`, '0') BETWEEN $minsgrovmo AND $maxsgrovmo)
LIMIT 0,$limitrows";
/Simon
Wouldn't that simply be the case where you will dynamically build a YEAR IN (..) clause based on the year selection? E.g. when 2008, 2010 and 2012 were selected:
SELECT * FROM SOIL_DATA WHERE YEAR IN (2008, 2010, 2012)
i have this code where you can select the date you like to attend the meeting.
How can I have this possible to select 2 dates at the same time?
Because in this code, one can only select 1 date. What should I add in here?
<div style="background-color:#aaa">
<form method="post" action="[~[*id*]~]">
<input type="hidden" name="formid" value="registrationForm" />
<p>
<table>
<tr>
<td><label for="workshop" style="margin:0.5em">Termine:</label>
<td>
<input type="checkbox" name="termine1" value="Montag 4. Oktober 2010" eform="Termine::1"/> Montag 4. Oktober 2010 <br/>
<input type="checkbox" name="termine2" value="Mittwoch 13. Oktober 2010" /> Mittwoch 13. Oktober 2010 <br/>
<input type="checkbox" name="termine3" value="Freitag 22. Oktober 2010" /> Freitag 22. Oktober 2010 <br/>
</td>
</tr>
<tr>
<td><label for="email" style="margin:0.5em">Email:</label></td>
<td><input type="text" name="email" size="60" maxlength="60" eform="Email:email:1" /><td>
</tr>
<tr>
<td><label style="margin:0.5em; display:block" for="kopieren" >Bitte kopieren Sie den Anti-Spam Code ein: </label>
<img src="[+verimageurl+]" alt="verification code" border="1" style="margin:0.5em"/></td>
<td valign="top"><input type="text" name="vericode" size="20" />
</tr>
<tr>
<td rowspan="3" valign="right">
<input align="right" type="submit" name="submit" style="margin:0.5em" value="Register" />
</td>
</tr>
</table>
=========
This would be the other form look like, do I need to add here for the other dates?
<h3>Registration</h3>
<table>
<tr valign="top"><td>Termine</td><td>[+termine1+]</td></tr>
<tr valign="top"><td>Termine</td><td>[+termine2+]</td></tr>
<tr valign="top"><td>Termine</td><td>[+termine3+]</td></tr>
<tr valign="top"><td>Email</td><td>[+email+]</td></tr>
</table>
Make them Checkboxes instead?
<input type="checkbox" name="workshop1" value="morning-with-visit" eform="Selected Dates::1"/> 18 August 2010<br/>
<input type="checkbox" name="workshop2" value="morning-without-visit" /> 19 August 2010<br/>
<input type="checkbox" name="workshop3" value="afternoon-with-visit" /> 20 August 2010 (12h50)<br/>
Try it out here.
Change the inputs to type="checkbox". You will likely need to change the name attribute to correctly process server-side, assuming that's what you're doing.
I agree with the three answers supplied that you should use checkboxes, thus:
<input type="checkbox" name="morning-with-visit" eform="Selected Dates::1"/> 18 August 2010<br/>
<input type="radio" name="morning-without-visit" /> 19 August 2010<br/>
<input type="radio" name="afternoon-with-visit" /> 20 August 2010 (12h50)<br/>
On the server-side, you will only receive back the boxes that were ticked. Here is a PHP example...
if (isset($_POST['morning-with-visit'])) {
echo 'They selected "morning-with-visit"';
}
You can make radio inputs multi-selectable, but by putting each in its own name... like this example (I only mention it to say that is IS possible).
<input type="radio" name="workshop1" value="morning-with-visit" eform="Selected Dates::1"/> 18 August 2010<br/>
<input type="radio" name="workshop2" value="morning-without-visit" /> 19 August 2010<br/>
<input type="radio" name="workshop3" value="afternoon-with-visit" /> 20 August 2010 (12h50)<br/>
Note that if you do this, you can't actually "un-select" anything, which is bad. So many people use yes-no groups (although checkboxes are more natural for this).
You can't have multiple selections in a radio group. You need to use something like chekboxes and perform the validation yourself, to make sure that 2 values are selected. This can be done using javascript to get client-side validation before posting the values to the server.