473,657 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change the value of text feilds after the button is clicked

6 New Member
I have a form where the user has to enter values. to make it easy for the user there are some values already present in the feilds but if the user wants he can change it. the problem is i want to have a button which upon clicking should enter the value "null" to the feild. one of the text feild code i m displaying here
Expand|Select|Wrap|Line Numbers
  1. <input name="departFrom" type="text" id="departFrom" <?php 
  2.       if ($_POST['Void']=='Void') {
  3.       echo "NULL"; 
  4.       exit();
  5.       } else  {
  6.       echo $row_query2['arrivalTo'];
  7.       }
  8.       ?>/>
  9.  
[Please use CODE tags when posting source code. Thanks! --pbmods]

the button is
<input name="Void" type="button" id="Void" value="Void"/>

i didn't put the type as submit as the button is not submitting the form just changing the values. the problem here is its not acknowledging the if condition. I think the condition for checking the button is not right. i tried with if (isset($_POST['Void'])) as well but still its not working.
please can u guide me.

thanks in advance
Jun 8 '07 #1
3 1677
epots9
1,351 Recognized Expert Top Contributor
u forgot value

[HTML]<input name="departFro m" type="text" id="departFrom " value="<?php
if ($_POST['Void']=='Void') {
echo 'NULL';
} else {
echo $row_query2['arrivalTo'];
}
?>" />
[/HTML]

does that work?
Jun 8 '07 #2
ronnil
134 Recognized Expert New Member
for that kind of behaviour you need javascript, this can be implemented rather simply:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="somename" onfocus="this.value='null'" value="standardvalue">
[Please use CODE tags when posting source code. Thanks! --pbmods]

now when the textfield gains focus, the textfields value is set to 'null'. (you might just wanna put an empty string in there or just select the whole text instead)
Jun 8 '07 #3
nehaquick
6 New Member
Thanks for the reply. I had tried that as well. Its still not working. My problem is how to check the button is clicked or not. once the condition is set then it will automatically assign the value.
Jun 8 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3607
by: Christiaan | last post by:
I am trying to create a small javascript to change the button text and then submit it and do all kinds of form validations. So I have a button with the value "Save", when the button is clicked it should change into "Are you sure" and when you then click the button the form must be submitted. I know this is possible using a simple dialog box but I want to this it this way. This is what I already have, if you have any suggestions please...
6
18554
by: liglin | last post by:
The following script changes the color of text with the onmousover event. How can it be modified so it changes the text when the button is clicked? I'd want to avoid layers or CSS. Thanks, Liglin <HTML> <HEAD> <TITLE>Untitled Document</TITLE>
5
27008
by: AFN | last post by:
I'm trying to set a submit button to change text and color when clicked. Like saying "please wait" instead of "submit" and then changing the background color and text color. All works, except for changing the text color. I can set style.background='red' to change the background color to red. But if I say style.color='green' to change the text color, it does not change. How do you change the text color on a button when it is clicked?
9
2118
by: nail | last post by:
Hi. So I have a default.aspx page and 3 WebUserControls In the WebUserControl1, I have on TexBox, and in the default.aspx page I have a Button control. On the click event of the default.aspx page I need to change the TextBox.Text value, but not user the FindControl Method because I think this methos very slow. So, I want this, but not with findcontrol:
3
5005
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change data in the text boxes. Then an "update" button saves the data back to the database. What is the best way to change several properties on most of the textbox controls on the form when the "modify" button is clicked? (e.g. make them editible (and...
6
11276
by: timbobd | last post by:
I have a Windows form that displays a database table in a DataGrid. When you click on a row, the row's values get copied to bound TextBoxes below, and when the "Save" button is clicked the database is updated (as is the DataGrid row) with changed values in the TextBoxes. Here are some observations: 1) When changes are typed into a text box and "Save" is clicked, the changes are reflected in the DataSet.Tables().Rows().ItemArray value, but...
11
4460
by: harold.gimenez | last post by:
Hi group, I am trying to change the selection of an ASP Dropdownlist just like "Orange" is selected here: http://www.w3schools.com/js/tryit.asp?filename=try_dom_option_selected The following works fine on IE: document.getElementById('dropdown').options.selected = 0 //
2
1865
by: bytesbytes | last post by:
JSP Scenario: Login page containing user id and pwd text boxes, each having a key boad button (onclicking the key board button will take to key.jsp where the user can input values in text box) The keyed value in key.jsp text box should be returened to login.jsp in corresponding to the button clicked.(ie if user clicked useridtext box key board button then the value in key.jsp should be placed or if user clicked the pwd text keyboard button...
6
4511
by: gavy7210 | last post by:
hello i am using struts 1.2,Eclipse Platform Version: 3.4.2,mySql 5.0.1,jdk 1.5.. i have a login form(jsp) in which a user logs in,in case he doesnt enter his username and/or password an error is displayed using the <ul> tag and <html:errors> in the jsp. in the from class a vaidate method creates an actionerrors object adds all the errors to it and finally returns it. the ids are linked in messageresources.properties and appropriate...
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.