Explore the community Forums Lectora Lectora Questions & Answers Changing the HTML name of an object

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #325247 Score: 0
    Profile photo of Lazaro Perez
    Lazaro Perez
    Member
    beginner
    intermediate
    curious george
    wise owl
    friend finder
    contributor
    profile
    Group Member
    picture perfect
    advanced
    28 pts
    @sirwise23

    I am pretty sure the answer is no, but is there any way to change the HTML name of an object?

    I have done it by editing the HTML files int he back end but I really wish there was a way to do this in the GUI.

    There are times that I may copy an object from another course that may have a JavaScript call or an HTML code happening, and instead of just changing the HTML name of an object, I have to go and change all of the code to match the new random generated name.

    #325272 Score: 1
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    336 pts
    @ssneg

    Instead of addressing objects by their HTML names (which are random and cannot be set by you) in your code, you should address them by class name (which can be assigned by you to any object in Lectora). Then your JS objects will always be reusable.

    This post has received 1 vote up.
    #325282 Score: 1
    Profile photo of Renota D
    Renota D
    Member
    beginner
    intermediate
    friend finder
    LUC16
    LUC16 Attendee
    wise owl
    curious george
    contributor
    advanced
    1 pt
    @rd4384

    @sirwise23 I assign the html names to variables in my external JavaScript files so that I don’t have to remember the cumbersome names Lectora generates. For example, when using jQuery, I would do something similar to the following:

    var game = $(‘#image1972’); //Store game image element ID

    This post has received 1 vote up.
    #325302 Score: 0
    Profile photo of Jennifer Valley
    Jennifer Valley
    Member
    contributor
    beginner
    friend finder
    advanced
    lectora beginner
    verified member
    wise owl
    profile
    picture perfect
    curious george
    114 pts
    @jvalley4735

    For most objects, you can rename the HTML name by going to the objects Properties and from the Image group selecting the arrow in the bottom right-hand corner. This opens an expanded description of the object where you can add a long description for 508 or update the HTML name.

    Attachments:
    #325304 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    313 pts
    @timk

    Esp. if you want to use Renotas approach it may be possible to use the token replacement Math describes here:

    https://community.trivantis.com/forums/topic/javascript-and-htmlnames/

    It can be done by running the code in a Run javascript action added to the game image

    On: Page show
    Action: Run javascript
    Javascript:

    var game = $("#%HTMLNAME%");

    During Publication Lectora will replace %HTMLNAME% with the html name / the id of the object the action is added to.

    Tim

    #325305 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    313 pts
    @timk

    Hi Jenni,

    have you ever been able to actually change the html name of an object? Lectora won’t let me edit the field… and it still won’t let me select the html name with the keyboard / tab key.

    Tim

    #325311 Score: 0
    Profile photo of Jennifer Valley
    Jennifer Valley
    Member
    contributor
    beginner
    friend finder
    advanced
    lectora beginner
    verified member
    wise owl
    profile
    picture perfect
    curious george
    114 pts
    @jvalley4735

    That’s strange.  I’m running v16 but yes I can.  Let me try with 12.

    Attachments:
    #325313 Score: 0
    Profile photo of Jennifer Valley
    Jennifer Valley
    Member
    contributor
    beginner
    friend finder
    advanced
    lectora beginner
    verified member
    wise owl
    profile
    picture perfect
    curious george
    114 pts
    @jvalley4735

    I uploaded the same image and checked. Confirmed, I can do it from 12.1.4.  You might want to open a support ticket and see if something’s disconnected on your back end.

    Attachments:
    #325317 Score: 0
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    336 pts
    @ssneg

    Lectora 16.0.2 – I can select and copy HTML name of object but I cannot edit the names. I don’t think I ever could. Jenny, can you please upload a screenshot of editing the name? E.g. before and after, in the same title, same object?

    #325331 Score: 0
    Profile photo of Jennifer Valley
    Jennifer Valley
    Member
    contributor
    beginner
    friend finder
    advanced
    lectora beginner
    verified member
    wise owl
    profile
    picture perfect
    curious george
    114 pts
    @jvalley4735

    I don’t know why I had it stuck in my head that I could edit it! LOL I cannot edit the field.  The Lectora Information Center says “The HTML name is assigned when you add the object. The HTML name, which is used to identify the object, cannot be changed.” I think it’s time for some more coffee this morning…..

    #325345 Score: 0
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    336 pts
    @ssneg

    It’s just wishful thinking 🙂 Everybody wants to be able to edit HTML names!!! 😀

    #325348 Score: 1
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    You can re-assign the numeral part of the HTML Name (id) but not the characters. If you write your external code accordingly, this could give you the control you are looking for.

    1. Add the object(s) you want to rename to your project but do not add actions to them yet.
    2. Make a note of the HTML name that was automatically assigned.
    3. Save the project and close Lecotra.
    4. Open the .awt in a text editor (notepad works fine – use open with..).
    5. Find the line that assigns the ID, example <shape id=”49” parent=”2″ ontop=”false” proportional=”false”>
    6. Change the number in the parentheses <shape id=”995” parent=”2″ ontop=”false” proportional=”false”> (Here I changed “49” to “995“.)
    7. Save the file and re-open in Lectora. Your object now has the name you assigned.

    You can do this any time you add an object as long as you have not used it in any actions.

    Darrel

    This post has received 1 vote up.
    #325369 Score: 0
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    119 pts
    @mnotermans5114

    In Lectora itself you cannot edit ( maybe change parts like Darrel suggest..didnot check that ) the html names….
    however if needed…

    You can open the .awt in any text-editor that supports xml…. find the html-names you want to change…and name them exactly as you want.

    My setup for creating Lectora .awt from a .PSD does exactly that…create a Lectora .awt with custom html names.

    #325370 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    Did you read my post?

    #325382 Score: 0
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    119 pts
    @mnotermans5114

    Apparently not good enough, cause now noticing its the same method 😉 Stupid me 🙂

    In Fact you can even do this when actions are assigned, but you have to find the proper action and retarget that to your newly created htmlname

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.