View Full Version : HTML5 Notepad - How to modify this script?

03-24-2011, 11:25 AM
1) Script Title: HTML5 Notepad

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/html5notepad.htm

3) Describe problem: Can this script be modified in a way that it can be used as a local phonebook? I replaced the textarea part in the script with a table with multiple text areas but when I click save only the input in the first text are is saved, all others are ignored. Any help on how to fix this? Or can another script be made?

Live demo: www.yesilsms.com
Paste url bar: javascript:rehber.loadpad('rehber',%20['right','center'])

03-24-2011, 04:14 PM
It's possible to either directly list multiple fields or loop through all fields in a certain form, but these are not stored anywhere permanently. Will this be helpful to the user?
What you will need to do is modify the load and save functions significantly so that they either loop or list multiple elements. You can use the same basic structure as the current script, but this is a significant modification.

03-24-2011, 05:18 PM
How, for example? My javascript knowledge is close to zero... :/

03-24-2011, 06:45 PM
I don't have a working example. The explanation I gave was conceptual. It's possible, but not simple. As I said, it would be a significant modification. If you would like this, you could request it in a future update (if you aren't in a hurry), or you could post this in the paid work requests board (if you are in a hurry).
If you aren't good with Javascript yet, this would be difficult to do.

Listing multiple fields would be a little easier than looping, but it would be more work especially if the form might change sometimes-- is it always exactly 10 fields long (for example)?

As a place to start, you'd need to modify this function so that the code to save a single field here would instead save many fields. You could duplicate the lines and change the IDs, but it might be a little more complicated than that. And for the loading I imagine it would be more complicated because you actually need to set the values of all the fields that way.

function savenote(){ //private savenote function
largestorage["notepad_"+id]=formfields.$subject.val() + "|||" + formfields.$content.val() //save subject and content fields, separated by "|||"

For someone who is experienced with Javascript (probably more so than I am), this would not be especially difficult, though not "easy" either.