Flying35 Posted November 28, 2011 Share Posted November 28, 2011 Hello phpfreaks, I try to make buttons witch can enable text field that are disabled. But it doesn't work when I'm working with variables. while (list($id,$naam,$voorraad,$bestelgrootte,$doelvoorraad,$prijs,$aantal,$wijzig) = mysql_fetch_row($res)) $inkvm .= "<tr><td>".$id. "</td><td>".$naam. "</td><td>".$voorraad. "</td><td>".$bestelgrootte. "</td><td>".$doelvoorraad. "</td><td>".$prijs. "</td><td> <form name='".$id."'> <input type='text' value='".$aantal."' name='".$id."' size='2' disabled='disabled'/> </form> </td><td> <input type='button' value='Aanpassen' OnClick='document.".$id.".".$id.".disabled=false;'/> </td></tr>"; Does someone know why this isn't working? already thanks. Link to comment https://forums.phpfreaks.com/topic/251977-disable-and-enable-text-fields/ Share on other sites More sharing options...
joe92 Posted November 28, 2011 Share Posted November 28, 2011 You'll need to edit the onclick to something along these lines; onclick="document.getElementById('id').disabled = false;" .. Give an id to the textfield and replace the above id with the id of the text field Link to comment https://forums.phpfreaks.com/topic/251977-disable-and-enable-text-fields/#findComment-1291937 Share on other sites More sharing options...
Flying35 Posted November 28, 2011 Author Share Posted November 28, 2011 thanks it works now, I used the wrong quotes. Link to comment https://forums.phpfreaks.com/topic/251977-disable-and-enable-text-fields/#findComment-1291952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.