Updated 030 How to filter a list field based on association with another field (markdown)
@ -35,7 +35,7 @@ SetRegion is quite simple, mainly because most of the work had already been done
|
||||
|
||||
* ### Strings - Select_A_Region, Create_A_Region
|
||||
|
||||
[00:09:55](https://www.youtube.com/watch?v=Z8FLifQOjUk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m55s)The 'select_a_region' is a JavaScript variable that gets set through PHP, which will be discussed at later stage. Basically it's just a string that says that the region should be selected. [00:10:21](https://www.youtube.com/watch? v=Z8FLifQOjUk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m21s) If there is no array returned, other variable should be used, the 'create_a_region' which is also just a string.
|
||||
[00:09:55](https://www.youtube.com/watch?v=Z8FLifQOjUk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m55s)The 'select_a_region' is a JavaScript variable that gets set through PHP, which will be discussed at later stage. Basically it's just a string that says that the region should be selected. [00:10:21](https://www.youtube.com/watch?v=Z8FLifQOjUk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m21s) If there is no array returned, other variable should be used, the 'create_a_region' which is also just a string.
|
||||
|
||||
Go to 'jQuery.each(array,function(i,id){' , select 'array' and use the 'id', and check if the 'id' is in 'regions'. If it is in 'regions', append the 'id' as a value. As you remember in 'regions' the text as well as the 'id' had been saved. [00:10:51](https://www.youtube.com/watch?v=Z8FLifQOjUk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m51s) So that is how to get the text, simply adding it in there(see video). It could have been done in the PHP, but I felt let the browser help us with some of the lifting. There is regions, if it's a huge table it should be approached differently. Eventually it is checked whether the 'id' and the 'region' equals(id==region). Since if it does it is necessary to ensure to set the 'region' value.
|
||||
|
||||
|
Reference in New Issue
Block a user