Pardon me while I probably over-complicate the uber simple, but I'm trying to subtract two text/integer fields in a form. However, I keep getting a 'variable TXTMILEAGE2 is undefined' error. What am I missing/obviously doing wrong?
Code snippit:
<table>
<tr>
<td><label for="txtmileage1">
<div align="right">Start Mileage:</div></label></td>
<td><cfinput type="text" name="txtmileage1" message="Enter your start mileage."
required="yes" class="box" id="txtmileage1" tabindex="2" validate="integer" />
</td>
</tr>
<tr>
<td><label for="txtmileage2">
<div align="right">End Mileage:</div></label></td>
<td><cfinput type="text" name="txtmileage2" message="Enter your ending mileage."
required="yes" class="box" id="txtmileage2" tabindex="3" validate="integer" />
</td>
</tr>
<tr>
<td><label for="txtMileage3">
<div align="right">Miles Driven:</div></label></td>
<td><cfset txtmileage3 = txtmileage2 - txtmileage1>
<cfinput type="text" name="txtmileage3" value="#txtmileage3#" disabled="true"
class="box" id="txtmileage3" tabindex="4"/>
</td>
</tr>
</table>
Also, this page is being run on a legacy server that hasn't been updated since 2005. Hence the old MX7.
Related
<form data-request="onSend" data-request-update="'{{ __SELF__}}::attbanco': '#banco' "
data-request-flash >
<table>
<tr>
<td>Nome: </td> <td ><input type="text" id="nome" name="nome"></td>
</tr>
<tr>
<td>Idade: </td> <td ><input type="number" id="idade" name="idade" value="{{usuario.idade}}"></td>
</tr>
<tr>
<td>Telefone: </td> <td ><input type="text" id="telefone" name="telefone" value="{{usuario.telefone}}"></td>
</tr>
</table>
<button type="submit" >Enviar</button>
<input type="hidden" value="{{usuario.id}}" name="id">
this code work, saves the values on database, but i need manually refresh page to see the result on my
screen, someone know how refresh after submit?
Please, explain most simple possible, i am newbie
The best way to do what you want is to put the form in a partial and update it when the form is submitted.
Replace your form with this:
<div id="specialForm">
{% partial __SELF__~"::specialForm" %}
</div>
Create a partial to describe the form; I used specialForm. It should reload the form and clear the content.
<form data-request="onSend" data-request-update="'{{ __SELF__}}::attbanco': '#banco', '{{ __SELF__ }}::specialForm': '#specialForm' "
data-request-flash >
<table>
<tr>
<td>Nome: </td> <td ><input type="text" id="nome" name="nome"></td>
</tr>
<tr>
<td>Idade: </td> <td ><input type="number" id="idade" name="idade" value="{{usuario.idade}}"></td>
</tr>
<tr>
<td>Telefone: </td> <td ><input type="text" id="telefone" name="telefone" value="{{usuario.telefone}}"></td>
</tr>
</table>
<button type="submit" >Enviar</button>
<input type="hidden" value="{{usuario.id}}" name="id">
</form>
I have a table like this:
<table>
<tbody>
...
<tr>
<td>
<div class="radio-inline">
<input name="sms_provider" type="radio" value="2" id="2">
<label class="text-gray-dark" for="2"> </label>
</div>
</td>
<td data-label="Server name">ServerA3</td>
<td data-label="Description"></td>
<td data-label="Status">
<label class="text-success">
<clr-icon shape="check"></clr-icon>
Default
</label>
</td>
<td data-label="Actions">
<a href="http://example.com/public/smsconfigurations/2/edit" data-tooltip="Edit Server">
<clr-icon shape="pencil" size="22" style="width: 22px; height: 22px;"></clr-icon>
</a>
</td>
</tr>
...
</tbody>
</table>
Now I wanna to check ServerA3 has Default status or no. As matter of fact I expect ServerA3 has Default text as siblings. What should I do?
I try with this code, but it doesn't work:
expect(element(by.xpath('//td[contains(text(), "ServerA3")]')).getWebElement().getDriver().findElement(by.css('*[data-label="status"]')).getText()).toContain('Default');
var status = element(by.xpath('//tr[td[.="ServerA3"]]/td[#data-label="Status"]'))
.getAttribute('innerText');
expect(status).toEqual('Default')
<br>
<br>
To add new COT click on "Add New COT"
<div class="stepandbutton">
<div class="globalbuttoncell">
<a class="buttonlink blockpage" onclick="javascript:addnewcot();" href="#">Add New COT</a>
</div>
</div>
<input id="ComingFromForm" type="hidden" value="ComingFromForm" name="ComingFromForm">
<input id="priorCOT" type="hidden" value="" name="priorCOT">
<input id="rtncode" type="hidden" value="false" name="rtncode">
<input id="refresh" type="hidden" value="NO" name="refresh">
<input id="PDate" type="hidden" value="" name="PDate">
<table>
<thead>
<tr>
<th align="center"> *Trade Class</th>
<th align="center">*Description</th>
<th>Category </th>
<th>Exclude from AMP</th>
<th>Exclude from AMP 5i</th>
<th>Exclude from ASP</th>
<th>Exclude from BP</th>
<th>Exclude from NFAMP </th>
<th>Exclude from Texas </th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center">
<input id="COT" class="data" type="text" value="" style="width:100px;" name="COT">
</td>
<td align="center">
<input id="Desc" class="data" type="text" value="" style="width:250px;" name="Desc">
</td>
<td align="center">
<select id="COTCategory" class="data small" name="COTCategory">
</td>
<td align="center">
<td align="center">
<td align="center">
<td align="center">
<td align="center">
<td align="center">
</tr>
</tbody>
</table>
</form>
<br>
<br>
I need to verify only ""To add new COT click on "Add New COT""" which is in the 3rd line is present.I have tried with //br[contains(text(),"To add new COT click on "Add New COT"")]. But it showing error that locator is not found.Please suggest another ways to verify it.
This is ugly but would "work":
<tr>
<td>verifyText</td>
<td>//body</td>
<td>*To add new COT click on "Add New COT"*</td>
</tr>
But as the commenter above mentions you don't want the br element. What you want to locate on is the element that you didn't provide that lives ABOVE the code you attached to. That would be best.
<table width=100% cellspacing=0 cellpadding=0 class="form_table">
<form name="suggestion_box" action="suggestion_box.php" method=post>
<input type="hidden" name="form_submit" value="1">
<tr>
<td width=40% align=right valign=top class="form_label_cell">
<b class="form_label">
First Name<br>
</b>
</td>
</table>
<br>
<input type="image" src="button_submit.gif" alt="Submit" class="input_gfx">
<input type="hidden" name="form_submit" value="1">
<br>
</form>
</table>
This is my form, I don't know why that doesn't work with Firefox, can you help me?
I've been reading hundreds of answers since weeks ago, but I couldn't make it work.
1) You can't place your form within the table like that.
2) You are closing your table (</table>) twice.
3) You never closed your row (</tr>).
Try this simplified code instead:
<form name="suggestion_box" action="suggestion_box.php" method=post>
<table width="100%" cellspacing="0" cellpadding="0" class="form_table">
<tr>
<td>
<input type="hidden" name="form_submit" value="1">
</td>
</tr>
<tr>
<td>
<b class="form_label">
First Name
</b>
</td>
</tr>
<tr>
<td>
<input type="submit" src="button_submit.gif" alt="Submit" class="input_gfx">
</td>
</tr>
</table>
</form>
You have to specify a name for your image input field.
<input type="image" name="yourimage" src="button_submit.gif" alt="Submit" class="input_gfx">
You can access the x/y values using the POST variables yourimage.x / yourimage.y (or in PHP yourimage_x, yourimage_y).
I have had problem with forms and inputs which don't have id's, Try giving id's to the form and form elements and add type="submit" to your submit button.
I have a problem, my client needs me to change a drop down menu to a radio button selection, 1 of them, needs to be endless options to be clicked, the other max of 4 out of 10.
This is what my form looks like:
<form id="contact-form" name="contact-form" method="post" action="submit.php">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="35%"><label for="name">Name</label></td>
<td width="52%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td>
<td width="13%" id="errOffset"> </td>
</tr>
<tr>
<td><label for="email">Email</label></td>
<td><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td>
<td> </td>
</tr>
<tr>
<td><label for="subject">Area of Interest</label></td>
<td><select name="subject" id="subject">
<option value="" selected="selected"> - Choose -</option>
<option value="interactiveDinner">Interactive Dinner Series</option>
<option value="winemakerDinner">Winemaker Dinners</option>
<option value="Culinary Travel">Culinary Travel Adventures</option>
<option value="education">Food & Beverage Education</option>
<option value="host a Shikany Event">Host an event at your location</option>
<option value="partnership">Partner with us</option>
<option value="Hire Shikany">Hire Chef Michael Shikany for your event</option>
<option value="Charity Inquiry">Charity / Philanthrophy / Non-profit Inquiry</option>
</select> </td>
<td> </td>
</tr>
<tr>
<td valign="top"><label for="message">Please provide color to your inquiry</label></td>
<td><textarea name="message" id="message" class="validate[required]" cols="35" rows="5"><?=$_SESSION['post']['message']?></textarea></td>
<td valign="top"> </td>
</tr>
<tr>
<td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td>
<td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
<td colspan="2"><input type="submit" name="button" id="button" value="Submit" />
<input type="reset" name="button2" id="button2" value="Reset" />
height="16" alt="loading" /></td>
</tr>
</table>
</form>
<?=$success?>
</div>
It sounds like you need to use check boxes instead of radio buttons. That will allow the user to select as many of the options as they want. To limit the number of selections they can make to 4, you can use the code found at http://www.javascriptkit.com/script/script2/checkboxlimit.shtml
Hope this helps.
You will not be able to achieve what you describe with radio buttons, you will need to use checkboxes. This is simply so more than one option can be selected.
Also if you name each checkbox in each group with the same name, something like select1[] and select2[]. Then when you post your form back to the server, the selected options will magically be in an array.
If you want to limit the number of selected boxes, then you will have to use some javascript that fires on the click event of each checkbox to count the number selected and allow or disallow any further selections.