I have a table of transactions which I load into the database from a CSV file weekly, assigning a php uniqid() as I go. The user is allowed to modify one field only so I have set the other edit screen fields to readonly. However I would like the user to be able to add new records via the "Add Record" button on the browse form. I am experimenting with Javascript (after browsing the form source) to modify the element class from "readonly" to "objects", but is this the way to acheive the result?
I am new to Javascript and PHP!
Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Different Form for Add Record
Re: Different Form for Add Record
vario,
Using nuLoadThis()
http://wiki.nubuilder.com/tiki-index.ph ... uLoadThis_
you could have all fields starts as editable and then do this..
Steven
Using nuLoadThis()
http://wiki.nubuilder.com/tiki-index.ph ... uLoadThis_
you could have all fields starts as editable and then do this..
Code: Select all
function nuLoadThis(){
if(document.getElementById('recordID').value != '-1'){ // '-1' means a new record
document.getElementById('field1').disabled=true;
document.getElementById('field2').disabled=true;
document.getElementById('field3').disabled=true;
}
}
Steven
-
- Posts: 154
- Joined: Mon Dec 05, 2011 12:23 pm
- Location: Newton Abbot, UK
- Has thanked: 2 times
- Been thanked: 1 time
Re: Different Form for Add Record
Steven,
Thanks for this. After some browsing of the form source code and a certain amount of Googling I had also tried using these two functions:
document.getElementById('ftx_tran_date').class='objects'
document.getElementById('ftx_tran_date').removeAttribute('readonly')
I like your solution as it involves less code!
vario
Thanks for this. After some browsing of the form source code and a certain amount of Googling I had also tried using these two functions:
document.getElementById('ftx_tran_date').class='objects'
document.getElementById('ftx_tran_date').removeAttribute('readonly')
I like your solution as it involves less code!
vario