Last week, I was working on collecting real-time information filled up online and generating them as a feedback to backend in order to realize an instant interaction with backend which allows users have a real-time overview of how the model looks like.

For a static interface, it's convenient to gain frontend information with the help of ID. And as we all know, every control on a website is supposed to have a unique id so that it can be called precisely and promptly.

However, one of the most intractable tasks is to find out ID of a dynamically generated control. On one hand, you can not just allocate 1,2,3,4,... to each control. Because once you need the id of a dropdown list, how could you know exactly it's 3 instead of 4. On the other hand, we have multiple categories in one time. The paras you saved are just under one category which means you don't have to traverse all the variables in your script.

As a result, the best way to generate dynamic ID is to form it in a formula which includes a connection between this control with the category it belongs to. By doing so, it can make out the id you need precisely and efficiently. The time complexity decreases from N^2 to N.

The last step is to process the information I gain online, like removing blanks. Since our way to give feedback to backend is through an URL, it's easily to ignore that there shouldn't be a blank space. Once a complete and correct URL is set, the 3D model will change with parameters.

Next Post Previous Post