-
Script: Form field Limiter (Error found)
In general the scripts works very fine, but if you are using variable names for input or textarea like "var[]" to use a arrays for your form input then the script produces an error.
Because the use of arrays in form variables is a standard, the script should support this standard as well.
<input type="text" name="var" /> ...works fine with scipt
<input type="text" name="var[]" /> ...works not with script
Who can help, because my JavaScript Skill is not good ...?
with kind regards
Stahlratte
-
-
Script: Form field Limiter
Is there nobody with a clue here ...?
-
-
Well, it is the weekend. Also, please allow at least 2 to 3 days for a response, as I usually try and answer questions twice a week.
Last edited by ddadmin; 11-21-2004 at 10:26 AM.
-
-
This sounds very good
Ok ... that sounds very good.
One completion: You can also use a full array name like "varname[value1]" for the imput's name and you will get the error as well.
And if someone is asking what the sense is for an array like this in forms ... then think about 100 inputfields and how you will use the posted data in a loop or push them to a function.
With arrays in a form you can save many code and accelerate your scripts.
-
-
Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.
Ok, I see the problem. I'm still thinking about it, but this is a tricky problem, since by default JavaScript- and this script- requires that each form element have a unique name in order to work. The array syntax (ie: var[]) carters to server side languages like PHP and CGI, but never JavaScript.
I've made a note of the shortcoming of this script in this respect, though I can't say yet when to expect an update.
-
-
Thank you for your investigations!
How unfortunate, because "varname[value1]" would be a unique name and Javascript support Arrays as well.
I'm not sure, but is it possible to use a unique ID instead the name of the element to proceed the functions ????
So I could write <input id="xyz" name="myFormArray[xyz]" type="text" ....
Best regards
Stahlratte
Last edited by Stahlratte; 11-24-2004 at 08:43 AM.
Reason: additional comment
-
-
Yes, rewriting the script to use the ID attribute would be one option. It would be more of a hassle integration wise, as the webmaster would need to add the ID attribute to the form elements in question while with the name attribute, it's normally already present.
I'll give this some thought.
-
-
Ok, then I'll still waiting for your grandiosely solution :-)
.. but the "ID Solution" would be really good enough for me.
Best regards
Stahlratte
-
-
Could someone give me a hint how the change the script to use IDs ??
-
-
Good news. The script has just been updated for this, so it now supports both input by name or ID.
Here it is: http://www.dynamicdrive.com/dynamici...limitinput.htm
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks