I have a mvc program which can be run in 2 environments dev and prod.
I referred to this program in https://www.codeproject.com/Articles/17660/Single-web-config-file-across-all-environments-dev and attached
ConfitIt.dll to my MVC program. In Global.asax.cs and Application_Start method, I included
String environment = EnvironmentSettings.Environment;
In the Index.cshtml, I have a button whose value needs to change depending on environment
I want it to display "Push to" + whatever environment it's in
This is the code I have
<input type="submit" value="Push to" +EnvironmentSettings.Environment style="height:40px; width: 60px;font-weight: bold;background-color:#b6ffff; " /> <br />
I know this is wrong because I don't see the value. I tried this
#Html.Label("dynamic settings", EnvironmentSettings.Environment)
and I see the correct value
How can I do this or is there an alternate way instead of ConfigIt.dll?
Thanks
MR
Write as follows:
<input type="submit" value='#("Push to" + EnvironmentSettings.Environment)' style="height:40px; width: 60px;font-weight: bold;background-color:#b6ffff; " /> <br />
Related
I am working on automating a task. I want to click a Save button on a web form using VBA, but it's not working:
<input name="save" title="Save" class="btn" type="submit" value=" Save ">
<input name="save" tabindex="79" title="Save" class="btn" type="submit" value=" Save ">
I've tried ie.Document.all("save").Click, but it doesn't seem to work. What method do I need to click the button?
You can try going through all your "btn" class collection, and click the one with your save value:
Dim btnClassColl As Object, btn As Object
Set btnClassColl = ie.document.getElementsByClassName("btn")
For Each btn In btnClassColl
If btn.Value Like "*save*" Then
btn.Click
Exit For
End If
Next
Also: make sure that your web page has FULLY loaded before trying to automate anything.
Edit
In response to the comment:
This code is neither giving error nor its clicking on btn. Can this be because there are two buttons on web page with same name and function?
An alternative solution would be that if you know the index number of the collection item, you can simply use that index number and not loop at all. In this case, your index # is 1 (remember: Base 0).
Try this alternative:
Dim btn As Object
ie.document.getElementsByName("save")(1) '1 actually means #2 in index
I created a search container table that contains a column checkbox type, i.e.
<liferay-ui:search-container-column-text
name="territoriale"
orderable="<%= true %>"
>
<input type="checkbox" id="territoriale" checked="<%= cmt.getTerritoriale() == 1 %>" />
</liferay-ui:search-container-column-text>
This table is declared inside a jsp included using liferay-util:include, but can also be refreshed in the next steps by click on search button.
What happen is that when the table appears for the first time, I see that column just with text (value is "1"), when I click search button that runs the ajax call, the resource action return the correct checkbox in column.
Any ideas?
Below some screen shot
Thanks
Column after page load
Column after click on search button
This works fine on 6.2 CE ga5:
<liferay-ui:search-container-column-text
name="checkbox"
orderable="<%= true %>"
>
<% String checked = (Math.random() < 0.5) ? "checked" : ""; %>
<input type="checkbox" <%= checked %>/>
</liferay-ui:search-container-column-text>
So the root cause of your issue should be somewhere else. You may output cmt.getTerritoriale() into html to check its content.
I think, that checked="<%= cmt.getTerritoriale() == 1 %>" is not correct,
you may use checked or nothing.
See here about using checked attribute.
You can also use rowchecker as was mentioned in the comments of Pankajkumar Kathiriya.
i have a template page which has all the code i need for ten pages, where the only diff between the pages is some values
the majority of these have been working fine, however i have an issue with this section of code :
<p>
<p:spinner id="ajaxspinner0-19" value="#{tooltipBean.sectionSave}"
stepFactor = "1" min="0" max="19"
disabled = "#{formBean.number != 1}" >
<p:ajax update="ajaxspinnervalue " process="#this" />
</p:spinner>
</p>
the idea behind this code is it goes to the tooltipBean get the section save value, add this value into here and then for this to get the value from another bean
the value in the tooltipBean is
sectionSave = "#{markingBean.markToEdit.markSectionOne}";
and i use the template in the view pages by:
<f:event listener="#{tooltipBean.setupForPageA}" type="preRenderView" />
<ui:include src="/WEB-INF/templates/commonForm.xhtml"/>
i have it working normally without using the template by using :
<p>
<p:spinner id="ajaxspinner0-19" value="#{markingBean.markToEdit.markSectionOne}"
stepFactor = "1" min="0" max="19"
disabled = "#{formBean.number != 1}" >
<p:ajax update="ajaxspinnervalue " process="#this" />
</p:spinner>
</p>
that code would give me the value 71 in the spinner, however the code from the template displays in the spinner #{markingBean.markToEdit.markSectionOne} which is correct i just need this to run and return 71 rather than showing me the value of the code
does this make sense, sorry if i have written it confusingly i am unsure on how to describe the issue
i think it just not getting intalised at the right time, would it be possible to intatlise the page with the values first and then give it time for that new value to get the data in this case 71 before being viewed by the user
You cannot specify EL from a backing bean like that. The spinner control assumes that it will have both get and set access to whatever is passed in as its value attribute. It won't try to interpret the specified value as EL, which could be quite a dangerous side affect.
Here's how I would approach it. Pass in the value as a parameter to your template:
<ui:include src="templates/commonForm.xhtml">
<ui:param name="spinnerValue" value="#{markingBean.markToEdit.markSectionOne}" />
</ui:include>
Then, reference that parameter in your template:
<p>
<p:spinner id="ajaxspinner0-19" value="#{spinnerValue}"
stepFactor = "1" min="0" max="19"
disabled = "#{formBean.number != 1}" >
<p:ajax update="ajaxspinnervalue " process="#this" />
</p:spinner>
</p>
I have two input fields
input(ng-model='form.firstName', name='firstName', id='familyName')
and
input(ng-model='form.lastName', name='lastName')
I also have a textarea field
textarea(id='fieldInfo', ng-model='fieldInfo', name='fieldInfo' cols='15', rows='10')
I would like to change the text in the TextArea to "Please enter your first name" when the focus or cursor is in the First Name input and change it to "Please enter your last name" when the is on the last name inout and it should be able to toggle as the user switches focus from first name to last name and last name to first name.
Any assistance will be much appreciated.
Melroy
The ng-focus directive will not work for you if you are using one of the stable 1.0.x versions of AngularJS. However, I have created a working CodePen example of how you could do it without the ng-focus directive.
I created my own on-focus directive that evaluates an expression, which results in an update to the scope model being used by the textarea. I'm sure it could use some refinement, but the concept should still work for your application.
You can use the ngFocus directive if you are using angular 1.2.0.
In your controller:
var myApp = angular.module('myApp',[]);
myApp.controller('MyCtrl', ['$scope', function($scope) {
$scope.text = "";
}]);
And in your view:
<input type="text" data-ng-model="form.name" ng-focus="text = 'Please enter your first name'" />
<input type="text" data-ng-model="form.last" ng-focus="text = 'Please enter your last name'" />
<textarea name="area" id="textarea" cols="30" rows="10"> {{ text }} </textarea>
You can check this fiddle
Edit: Wrong fiddle link
I am using SafeCracker to create some entries on a site and when the form is submitted it comes up in a preview template.
I need to be able to display the selected category for the entry.
I am using the following code to display the results in the preview template:
{exp:safecracker channel="jobs" id="contact" return="jobs/preview/ENTRY_ID" entry_id="{segment_3}"}
<p>Job Type: {job_type}<br />
Category: {exp:channel:category_heading}{category_name}{/exp:channel:category_heading}<br />
Location: {job_location}</p>
<p>Description:<br />
{job_description}
</p>
<p>Apply by: {how_to_apply} at: {apply_value}</p>
<p>Company: {company}</p>
<p>Description: <br />
{company_description}</p>
{/exp:safecracker}
As it is, the Category: value is blank. What is the correct way to do this?
Thanks!
Use: {categories}{if selected}{category_name}{/if}{/categories}.
Failing that, you could use the query module:
{exp:query sql="
SELECT c.cat_name
FROM exp_categories c, exp_category_posts cp
WHERE cp.entry_id = {segment_3}
AND c.cat_id = cp.cat_id
" backspace="2"}{cat_name}, {/exp:query}