Support

Home Forums Event Espresso Premium JavaScript translation workaround issue

JavaScript translation workaround issue

Posted: January 2, 2014 at 7:12 am

Viewing 5 reply threads


Hannes Schnitzer

    January 2, 2014 at 7:12 am

    Hi,

    since EE does not support multiple languages registration forms, I implemented a simple (though dirty, please don’t judgde me ;) JavaScript workaround.

    Let’s say I have two different languages, English and German. When Setting up a dropdown question I name it “Color / Farbe” and set the values to “Blue / Blau” and “Red / Rot”. As a result I get the following (simplified) HTML structure:

    <label>Color / Farbe</label>
    <select>
    <option value="Blue / Blau">Blue / Blau</option>
    <option value="Red / Rot">Red / Rot</option>
    </select>

    Now via JavaScript I check the current language and manipulate the DOM to get the following result:

    <label>Color</label>
    <select>
    <option value="Blue / Blau">Blue</option>
    <option value="Red / Rot">Red</option>
    </select>

    Users now only see labels and values in their language. Great. But a problem emerges, I guess, on form submit. Let’s say the user selects “Blue”: In the database the value “Blue / Blau” gets stored, which is perfectly fine but on the admin panel when looking at the attendee data, the dropdown “Color / Farbe” has no option selected.

    If I turn off JavaScript everything works fine.

    Do you have any idea what could cause this issue?
    Thanks.


    Sidney Harrell

    • Support Staff

    January 2, 2014 at 5:09 pm

    Are you turning off JavaScript in the admin only, or in the registration form as well? I tried putting answers in for a question with slashes in it, and it seems to work fine.


    Hannes Schnitzer

      January 3, 2014 at 2:14 am

      I am completely turning it off in Chrome developer tools.
      Would it help if I gave you access to the dev server?


      Sidney Harrell

      • Support Staff

      January 3, 2014 at 1:57 pm

      It might. It should only take a little debugging code on the attendee admin page. You can fill out the form here and be sure to include ftp credentials.


      Sidney Harrell

      • Support Staff

      January 6, 2014 at 4:16 pm

      I found that if a question value has double spaces in it, then it is changed to a single space in the registration form or the value in the edit attendee screen. Then when the answer is compared, it does not match the value. I put a fix in on your site, in includes/functions/form_build.php changing line 304 and 305 to:

      $find = array( '&#039;', "\xC2\xA0", "\x20", "&#160;", '&nbsp;', '  ' );
      $replace = array( "'", ' ', ' ', ' ', ' ', ' ' );


      Hannes Schnitzer

        January 8, 2014 at 7:15 am

        Great! Thank you.

        Viewing 5 reply threads

        The support post ‘JavaScript translation workaround issue’ is closed to new replies.

        Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

        Event Espresso - Staging Server