So I want to take a the first few characters of a variable in my form and populate the title with that, how would I go about doing taking just the A.01. for example? Is there some kind of syntax I should be using to accomplish this?
Question
Question
Replies
You could add a Class tag to your title like this
UTHA TRANSIT AUTHORITY CORPORATE POLICY NO. <span class="someDropDownValue"></span>
And then add the code below to your JavaScript section so that it changes when you change the value of the drop-down menu.
You will also need to add the Class "someDropDown" to your drop-down menu
$(document).ready(function () { $(document).on('change', '.someDropDown select', doFunction); function doFunction() { var someDropDown = $('.someDropDown select').val(); var part_someDropDown = someDropDown.substr(0, 5); //alert(part_someDropDown); $('.someDropDownValue').html(part_someDropDown); } });
The issue is that I am saving the form to a location based on what they choose from that drop down. So for example, the location I would be saving this form would be A.01. Corporate Policies and SOPs. I want to retain this functionality while populating the UTAH TRANIST AUTHORITY CORPORATE POLICY NO. with just A.01 from the drop down. From my understanding with your method using javascript, the value of that drop down would change.
The value of the drop-down would stay untouched. What the JavaScript does is that it reads the first 5 characters from left to right of the value in your drop-down menu and it uses that to populate your title.
In your case, when you picked A.01. Corporate Policies and SOPs, the title would change to
UTHA TRANSIT AUTHORITY CORPORATE POLICY NO. A.01.
I tried the method you suggested, but when I save the form I only see "UTAH TRANSIT AUTHORITY CORPORATE POLICY NO.<span class="someDropDownValue"></span>". I cannot get that value to change. It may have to do with my "title" being a custom HTML element. I'm not actually using the title field.
Does it load with the choice that you want first or do you physically have to pick it from the drop-down menu?
This is what I see when filling out the form.
Is the "UTAH TRANSIT..." part of the banner? Is it embedded in the image? Otherwise it shouldn't be displaying HTML
It is not embedded in the image. My mistake, I was adding the <span class="someDropDownValue"></span> into the Visual content area instead of the HTML content area. I added the <span class="someDropDownValue"></span> into the HTML content area, but it still will not display "A.01." for the title.
Ok. If you are using a Custom HTML field, make sure that you are pasting that content thru the HTML tab and not the Visual tab
I moved it to the HTML tab and it will not save to the repository with the Policy No. A.01.
Does it contain the A.01. when you save it?
No it does not.