Mick Barry
asked on
Allowed characters for input element name
What characters are valid for <input> element names?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As far as im aware there is no standard which defines valid characters for naming inputs however if you are using it in conjunction with server side processing its advisable to follow the naming convention for variables (in the case of php atleast - which will be used upon handling the posted data) which is an underscore or a letter followed by any number/combination of letters, numbers and underscores.
ASKER
Yes, I'm starting to think its more a js problem.
I'm having problems using the following to access a form element:
objForm.MQ^15234^1^
where MQ^15234^1^ is the input element name
I'm having problems using the following to access a form element:
objForm.MQ^15234^1^
where MQ^15234^1^ is the input element name
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've actually run into this problem switching it from _ (for different reasons) :)
So call it using objForm.elements['MQ^15234 ^1^']?
>>...switching it from _ ...<<
Did it not work with underscores? if so, maybe your problem is not in the variable naming but in something else related to your varaible. Maybe a duplicated name that is missleading you or something like that.
Can you post a link to your page?
Did it not work with underscores? if so, maybe your problem is not in the variable naming but in something else related to your varaible. Maybe a duplicated name that is missleading you or something like that.
Can you post a link to your page?
ASKER
> So call it using objForm.elements['MQ^15234 ^1^']?
thats failing
> Did it not work with underscores?
it did work with _ but that was causing problems further down the track.
> Can you post a link to your page?
no its on our development site
thats failing
> Did it not work with underscores?
it did work with _ but that was causing problems further down the track.
> Can you post a link to your page?
no its on our development site
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just to make sure, this is all client side javascript, right? If there is a server request in the middle of the process it could be an invalid chars issue. What kind of exception is it producing? Also, are you using IE? maybe a browser issue?
Did Zyloch's code work on your system?
Did Zyloch's code work on your system?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ended up going back to _ and doing a replace before posting to database.
Ran out of time to track down problem further so will split points between all.
Thanks for all your help :)
Ran out of time to track down problem further so will split points between all.
Thanks for all your help :)
Glad we could... kinda help ;-)