Post by haxcop » Sun Feb 05, 2023 10:40 pm

Hi and thanks for your time.
I'm currently doing a twig file that when selecting the option Self, this needs to open an infput field for the user input text ( in this case a URL or Path) .
Example:
Accelerometer [select]
condiontion (if 'self' is selected show = [input_text_url])
and the end result should look like this
perrmissions-policy: accelerometer self=("user-input-URL")

the current code is:

Code: Select all

<fieldset>
						<div class="form-group">
							<div class="col-sm-1">&nbsp;</div>
							<div class="col-sm-10">
								<legend>
									<i class="fa fa-shield"></i>&nbsp;&nbsp;{{ legend_Permissions_Policy }}</legend>
								<div class="alert alert-info">{{ about_Permissions_Policy }}</div>

								<div class="form-group">
									<label class="col-sm-4 control-label" for="input-type_accelerometer">
										<span data-toggle="tooltip" title="{{ help_accelerometer }}">{{ type_accelerometer }}</span>&nbsp;&nbsp;<i class="fa fa-chevron-right"></i>
									</label>
									<div class="col-sm-6">
										<select name="module_security_headers_status[Permissions_Policy][accelerometer]" id="input-type_accelerometer" class="form-control">
											<option value="" {{ Permissions_Policy.accelerometer and Permissions_Policy.accelerometer == '' ? 'selected=selected' : '' }}>{{ text_insecure }}</option>
											<option value="*" {{ Permissions_Policy.accelerometer and Permissions_Policy.accelerometer == '*' ? 'selected=selected' : '' }}>All Sources</option>
											<option value="()" {{ Permissions_Policy.accelerometer and Permissions_Policy.accelerometer == '()' ? 'selected=selected' : '' }}>None</option>
											<option value="self=()" {{ Permissions_Policy.accelerometer and Permissions_Policy.accelerometer == '' ? 'selected=selected' : 'self=()' }}>Self</option>
										</select>
									</div>
								</div>
								</fieldset>

New member

Posts

Joined
Tue Jan 14, 2014 9:38 pm
Location - Dublin

Post by straightlight » Thu Apr 20, 2023 8:02 am

OC version. Unless using a TWIG extension, with OC, better to use Events from the controllers in order to achieve such validations since self URLs from the admin may also involve the using of a user token or an API token.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: matteovisotto and 44 guests