Topic: I have a problem

People have been reporting that the JavaScript alerts that are displayed when you submit an incomplete form aren't translated. This is a known issue that I just haven't worked on before because I didn't know how to solve it (I still don't). An example is when you don't fill in the username. The alert would say:

"username is a required field in this form."

Nothing wrong with that. However, if the forum language is set to swedish, the alert would say:

"username är ett obligatorisk fält i detta formulär."

As you can see, "username" isn't translated (the swedish word is användarnamn). The reason is that the error message is displayed by a JavaScript function that simply goes through all form elements and locates the ones starting with req_. If an element starts with req_ and isn't filled out, the function displays an alert starting with the name of that element (minus the req_). The user pettan suggested that I translate the names of the different form elements. The form element "username" would in swedish be translated into "användarnamn". There is however a problem with this approach and that is that the HTML standard has strict rules regarding the naming of form elements. The standard says:

"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")."

Which practically means it's impossible. I have no idea how to solve this and would gladly accept any ideas and suggestions you might have.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: I have a problem

Nevermind! Cactuz came up with an idea that I believe will work just fine. I'm gonna work on it now :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: I have a problem

Fixed!

"Programming is like sex: one mistake and you have to support it for the rest of your life."