| | |
customised the locked textboxes and save as new data
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hi
sorry but what you want...
if you want that somebody clicks on button that time textbox enable so you can call javascrit function on button click event
As i posted one example here
Thanks
sorry but what you want...
if you want that somebody clicks on button that time textbox enable so you can call javascrit function on button click event
As i posted one example here
PHP Syntax (Toggle Plain Text)
<input type="text" disabled="disabled" name="txt1"/> <input type="button" value="Click me" onblur="func_unlock();"> <script type="text/javascript"> function func_unlock() { document.getElementByid('txt1').disabled=false; } </script>
Thanks
"Be honest"
"Confidence is everything"
"Confidence is everything"
•
•
•
•
<input type="text" disabled="disabled" name="txt1"/> <input type="button" value="Click me" onblur="func_unlock();"> <script type="text/javascript"> function func_unlock() { document.getElementByid('txt1').disabled=false; } </script>
onclick ?That wouldn't fire when the button was clicked, but rather when the button is deselected.
Edit:
And you misuse the name attribute.
Only IE incorrectly fetches tags via the
document.getElementById function based on their name attribute.You should use the id attribute if your intend to fetch the element using that function.
Like:
html Syntax (Toggle Plain Text)
<html> <head> <title>JS Click Test</title> <script type="text/javascript"> function EnableBox() { var box = document.getElementById('disabledBox'); box.value = ""; box.disabled = false; box.focus(); } </script> </head> <body> <input id="disabledBox" type="text" disabled="disabled" value="I'm disabled" /> <button onclick="javascript: EnableBox();">Enable</button> </body> </html>
Last edited by Atli; Jun 12th, 2009 at 1:29 pm. Reason: Added some stuff
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
•
•
Join Date: May 2009
Posts: 81
Reputation:
Solved Threads: 0
Thanks Tulsa & Atil,
but as far I understand the example you gave is for a specific / one textbox.. Am I right?
What I intend to do is..
1- by clicking 1 button-"customise"..all textboxes will we unlocked
2- and we can update/edit the data in it..
3- subsequently save the data as a new set of data in a database.
I used to do it in VB but as I am a php newbie.. I don't have any ide of it.
Thanks in advanced
but as far I understand the example you gave is for a specific / one textbox.. Am I right?
What I intend to do is..
1- by clicking 1 button-"customise"..all textboxes will we unlocked
2- and we can update/edit the data in it..
3- subsequently save the data as a new set of data in a database.
I used to do it in VB but as I am a php newbie.. I don't have any ide of it.
Thanks in advanced
•
•
Join Date: May 2009
Posts: 81
Reputation:
Solved Threads: 0
•
•
•
•
Thanks Tulsa & Atil,
but as far I understand the example you gave is for a specific / one textbox.. Am I right?
What I intend to do is..
1-is it possible to do this in Php? If not..it is ok..I might change my idea..edit the boxes individually & finally save it as a new set of data.••••by clicking 1 button-"customise"..all textboxes will we unlocked
2- and we can update/edit the data in it..
Just insert [INSERT INTO] new data in databse, isn't it?••••3- subsequently save the data as a new set of data in a database.
BUt How to update/increase the ID automatically in MySQL database. Logically ID+1, but I do not know the syntax.
Thanks in advanced
•
•
Join Date: May 2009
Posts: 81
Reputation:
Solved Threads: 0
ok..thanks.this is my code
php Syntax (Toggle Plain Text)
<?php $query= mysql_query(" SELECT * FROM lesson WHERE lessonID='" . $_GET['lessonID'] . "'"); while($entry=mysql_fetch_array($query)) { echo " Subject: "; echo '<input name="subject" readonly="readonly" value="', $entry['subject'] , '" /><br />'; echo " Year:"; echo '<input name="year" readonly="readonly" value="', $entry['year'] , '" /><br />'; } ?>
If you want JavaScript to enable multiple boxes with one button click, you need to either statically fetch them all (like my example did, but with more than one box), or create a script to fetch all of the boxes you want.
The
You could give all the boxes that you need to enable a specific attribute to check, like 'doEnable', which you could fetch in your JavaScript code with the
Like:
And P.S.
If you want to send multiple <input> boxes with the same name to PHP, they should be named
The
document.getElementsByTagName could fetch all the input elements for you so you could sort through them and find those you need to enable. javascript Syntax (Toggle Plain Text)
var boxes = document.getElementsByTagName('input'); for(var i = 0; i < boxes.length; i++) { // Sort through the boxes here. }
You could give all the boxes that you need to enable a specific attribute to check, like 'doEnable', which you could fetch in your JavaScript code with the
getAttribute function.Like:
html Syntax (Toggle Plain Text)
<input doEnable="yes" .../>
javascript Syntax (Toggle Plain Text)
if(boxes[i].getAttribute('doEnable') == 'yes') { boxes[i].disabled = false; }
And P.S.
If you want to send multiple <input> boxes with the same name to PHP, they should be named
<input name="name[]" .../> . That way all of them will be sent to PHP as an array, not just the last one in the form. Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
![]() |
Similar Threads
- Save data from DataGridView to XML (C#)
- Save data class (C++)
- cannot save data to access using vb.net2003 form (VB.NET)
- save data to access database (VB.NET)
- List View save data from it to mysql (VB.NET)
- Windows unable save data..failure of computer hardware or network conn. (Troubleshooting Dead Machines)
Other Threads in the PHP Forum
- Previous Thread: Warning: session_start() [function.session-start]: Cannot send session cache limiter
- Next Thread: auction script
| Thread Tools | Search this Thread |
ajax apache api array back basic beginner binary broken cakephp checkbox class cms code computing confirm cron curl database date delete display dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction memmory memory menu mlm multiple mysql navigation oop parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql syntax system table thesishelp trouble tutorial update upload url validation validator variable video web xml youtube






