Is it possible to generate a second AUTOID for use in a template.

Is it possible to generate a second AUTOID for use in a template.

by Steve Ambro v3.8 -
Number of replies: 3

I am developing a template/preset that can use this.

I do know that I can use var AUTOID2 = @@AUTOID@@+1 which will append the number 1 to @@AUTOID@@ but the use of  @@AUTOID2@@ does not work.



Average of ratings: -
In reply to Steve Ambro v3.8

Re: Is it possible to generate a second AUTOID for use in a template.

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Steve

There is only 1 AUTOID variable. Actually you only need 1. You just append other identifying info to it make new ones. e.g.

@@AUTOID@@_container or 
@@AUTOID@@_timer

That will work in the html/body of the template. But in the custom script area, to use the same id's you would do it like this;

@@AUTOID@@ + '_container' or 
@@AUTOID@@ + '_timer'


N.B. Probably most people in this forum don't know what we are talking about. It might be best to keep it in a Generico labelled forum thread of some sort.

In reply to Justin Hunt

Re: Is it possible to generate a second AUTOID for use in a template.

by Steve Ambro v3.8 -

Here is the code giving me grief:

span id="@@AUTOID@@">  Start Date </span>
 document.getElementById("@@AUTOID@@").innerHTML = StartDate;

As a single use in it works fine but in my preset, I need to use two ids.

From your note, it would seem that

span id="@@AUTOID@_Start1@">  Start Date </span>
 document.getElementById("@@AUTOID@@+ ' Start1'  ").innerHTML = StartDate1;

and

span id="@@AUTOID@@_Stop2">  Start Date </span>
 document.getElementById("@@AUTOID@@ +' Stop2' ").innerHTML = StoptDate;

both in the same preset could work.

Is my syntax still wrong or does it not work this way?


In reply to Steve Ambro v3.8

Re: Is it possible to generate a second AUTOID for use in a template.

by Steve Ambro v3.8 -

N.B. Probably most people in this forum don't know what we are talking about. It might be best to keep it in a Generico labelled forum thread of some sort.


I just  noticed this notice.  I placed it here because the discussion is labeled    "General Developers Forum".  I guess I guessed wrongly. Maybe someone can move this thread?