| | |
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
>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..
What are you doing? Tulsa & Atil explained how to enabled or disabled an item? Is there any problem to write a code for another textbox?
but as far I understand the example you gave is for a specific / one textbox.. Am I right?
What I intend to do is..
What are you doing? Tulsa & Atil explained how to enabled or disabled an item? Is there any problem to write a code for another textbox?
Failure is not fatal, but failure to change might be. - John Wooden
•
•
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 |
advanced apache api array basics beginner binary broken cakephp check checkbox class cms code codingproblem combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert ip javascript job joomla js limit link login mail menu mlm mobile multiple mysql oop outofmemmory paging parse password paypal pdf php problem procedure query radio random recursion remote return script search server sessions smarty sms source space sql stored syntax system table traffic tutorial unicode up-to-date update upload url validation validator variable video web webapplications youtube






