All,
I have been trying to figure this UI piece of my jenkins plugin for a few hours now. I am trying to nest checkboxes inside a radioBlock. The problem I am having is that the checkboxes are not hidden when the page loads at first. To hide them I have to highlight the radio then deselect.
<f:section title="Deployment method">
<f:radioBlock checked="true" name="deployMethod" title="Deploy new servers" value="Deploy new Servers"/>
<f:radioBlock checked="false" name="deployMethod" title="Script Deploy" value="Script deploy">
<j:forEach var="script" items="${account.scripts}">
<f:entry>
<f:checkbox name="Scripts" value="${script.scriptName}" title="${script.scriptName}"/>
</f:entry>
</j:forEach>
</f:radioBlock>
</f:section>
You need to put all the content you want to hide inside this:
<f:radioBlock checked="false" name="deployMethod" title="Script Deploy" value="Script deploy">
<f:nested>
....
</f:nested>
</f:radioBlock>
Related
I am creating a dropdown in XUL like this:
<button id="bid" oncommand="alert(event.target.nodeName)" >
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
I want to alert the value of nodeitem which is being clicked. Using event.target.nodeName giving nodeName as menuitem but using nodeValue is retuning undefined as it starts to take value of button node. How can I get the value of the menuitem clicked. I also tried $(this).val() but even that gave undefined. Using $(this).attr('value')
also didn't help. I can put oncommand for menuitem but that doesn't seem to be actual solution. Is that the only way or some method exist to get the value?
The XUL code you have in the question is non-functional. Either you should be using a <menulist> instead of a <button>, or your <button> needs the property type="menu" or type="menu-button". If you are going to use a <button> without the type="menu" property, you would actually have to open a popup in the command event handler for the <button> and then select from there. That does not appear to be what you are wanting. It is, however, quite doable. I use a construction like that in one of my add-ons, except I have it open when one of several <label> items is clicked. This allows re-use of a single <menupopup> for multiple different items in the window. In that case, the <menupopup> is a rather large amount XUL code that I did not want to repeat and maintain multiple duplicates in the XUL for the window.
The value of the <menuitem> selected:
Your actual question is how to get the value of the <menuitem> selected by the user. All of the code below is tested and functional. As you can see from the code you can get the value of the <menuitem> you select (at the time of selection) from: event.target.value.
Using a <menulist> element:
The most common element to use would be a <menulist>. This would normally be used when you are having the user select from multiple options a choice that is going to be remembered and used later, or used to adjust what is presented in the user interface. It would generally not be used to select from multiple immediate actions (which are acted upon and the choice not remembered). A <menulist> is what is used in the examples for <menuitem> and <menupopup> on MDN.
<menulist id="bid2" oncommand="alert(event.target.value)" >
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</menulist>
The above code will give you what looks like a button with a selection of <menuitem> entries when you click on it. It will alert with the value of the <menuitem> you have selected.
This will produce an item that looks like:
Which you can click on to open a drop-down list:
If you select an item:
You will get an alert:
And the object will then show your selection:
Using a <button> element:
It is also possible to use a <button> element with the property type="menu" or type="menu-button" specified. However, this provides no visual feedback to the user as to which option is currently selected. [Note: Your JavaScript could manually change the <button> label property to provide this feedback.] You could use this type of element if it is button that produces an immediate action rather than a selection that is remembered.
The code:
<button type="menu" id="bid2" label="A Button" oncommand="alert(event.target.value)">
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
This will produce an item that looks like:
Which you can click on to open a drop-down list:
If you select an item:
You will get an alert:
And the object will then NOT show your selection:
If you want to set the label of the <button> to reflect the selection made by the user, you could use:
<button type="menu" id="bid2" label="A Button" oncommand="event.target.parentElement.parentElement.label=event.target.value;alert(event.target.value)">
<menupopup>
<menuitem label="one" value="one" />
<menuitem label="two" value="two" />
<menuitem label="three" value="three" />
</menupopup>
</button>
When three is selected, that will result in a button that looks like:
Using a <toolbarbutton>:
You could, alternately, use a <toolbarbutton>.
When not hovered, doing so would look like:
When hovered:
When open for selection:
Choices in UI design:
There are many choices that you have to make when designing your user interface. There are many different ways to get to the same effective result, with somewhat different look and feel. You really should be trying these types of options on your own. You may find the XULRunner program XUL Explorer to be of use when prototyping XUL.
Selecting UI elements and a look and feel is, in my opinion, beyond the scope of questions on stackoverflow. While you probably won't get specific XUL help, you can ask UI design questions at: the User Experience stack exchange.
IS there a way to add a metadata xml in your jenkins job plugin that doesnt show up UI but can be populated by going into config.xml ?
I have something like this :
<!--
#author Kuber Kaul
-->
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:r="/lib/pib" xmlns:st="jelly:stapler">
<f:section title="${%xxx}">
<f:dropdownList name="details" title="${%xxx}">
<j:forEach var="s" items="${descriptor.artifactoryServers}" varStatus="loop">
<f:dropdownListBlock value="${s.name}" title="${s.url}" selected="${s.name==instance.artifactoryName}">
<f:nested>
<input type="hidden" name="artifactoryName" value="${s.name}"/>
<input type="hidden" name="artifactoryUrl" id="artifactoryUrlDeploy${s.url}" value="${s.url}"/>
<input type="hidden" name="stapler-class" value="dj.pib.productivity.ServerDetails"/>
<f:entry
title="${%Module Name}" name="module" readOnlyTextbox>
pam
</f:entry>
but this read only text box doesn't seem to send "pam" in the backend but null. Any way around it ?
I can't really understand your question. What do you mean by "metadata XML"?
The Jelly setup you're describing will show up in the UI (as a read-only textbox).
If you want the value pam to be hardcoded in a job's configuration, there's no need to place that in your Jelly XML — just hardcode that value in the Java code, where it's required.
In any case, to fix your Jelly, the syntax of this part is not correct:
<f:entry title="${%Module Name}" name="module" readOnlyTextbox>
pam
</f:entry>
readOnlyTextbox is a tag, not an attribute on entry, so it should probably look like this:
<f:entry title="${%Module Name}" field="module">
<f:readOnlyTextbox value="pam" />
</f:entry>
i have a jsp page where i am displaying my books detail in Struts2 jquery grid.
Now i want to call an action and pass rowid as a parameter to the the action class on the click of a row from my Jquery grid. And i also i want to specify the target of my div to refresh after calling my action.
These stuffs i know nicely through <sj:submit target="targetDivToRefresh" formId="form2" button="true"/> but i don't know how to do these task "when users click a row from my struts2 jquery grid".
Please help me to solve this issue.
my jsp page
<sjg:grid
id="bookgrid"
editurl="%{bookediturl}"
navigator="true"
editinline="true"
navigatorSearch="false"
autowidth="false"
width= "1550"
viewrecords="true"
navigatorRefresh="true"
navigatorDelete="true">
<sjg:gridColumn name="id" index="locationId" title="ID" formatter="integer" sortable="false" key="true"
search="false" editable="true" hidden="true" />
<sjg:gridColumn name="authLastname" index="authLastname" title="AuthorLastname" sortable="true" search="true" editrules="{required: true}"
editable="true" edittype="text" />
</sjg:grid>
try this:
$(function(){
$.subscribe('rowselect', function(event,data) {
alert(event.originalEvent.authLastname);
$("#targetDivToRefresh").load('your-struts2-action');
});
});
UPDATE
$("#targetDivToRefresh").load('your-struts2-action');
Reference Link: Struts2 jquery plugin showcase
Please make sure this event will be triggered, if you click on a row, i added test code alert() to make sure, it has been called during the event. there is still a thing, that i have to tell, you have to register your selectrow event in your <sj:grid> tag using onSelectRowTopics="rowselect"
UPDATE
$("#targetDivToRefresh").load("<s:url value="your-struts2-action"/>"+"?id="+event.originalEvent.id);
I have below code in a form for which i don't have access to and can not write any code. But in my webpage i have created another form where i can write some script.
My requirement: I have a dropdown and on selection of value from this i need to change the value of another drop-down field which is in different drop-down.
I tried the below script but not working.
Appreciate any help regarding this. Coding is not my profession but i am willing to learn.
enter code here
<script type="text/javascript">// <![CDATA[
function doStuff() {
alert($('#donation_campaign').val());
$('#PC1184$ddlDesignations').html($('#donation_campaign').val());
}
// ]]></script>
<h1>Thank you for support</h1>
<p> </p>
<p><label>Select your supporting chapter</label> <select id="donation_campaign" name="donation[campaign]" onchange=" doStuff()"><option value="Corpus Fund">DC Metro</option><option value="8">Boston</option><option value="13">AZ</option><option value="24">Austin</option><option value="13">JDU</option><option selected="selected" value="13">Common Pool</option></select></p>
form code for which i dont have access to:**
<tr id="PC1184_trDesignation">
<td class="BBFieldCaption DonationFieldCaption DonationFieldDropDownCaption">
<label for="PC1184_ddlDesignations" id="PC1184_lblDesignationCaption">Designation:</label>
</td>
<td colspan="2" class="BBFieldControlCell DonationFieldControlCell">
<select name="PC1184$ddlDesignations" id="PC1184_ddlDesignations" class="BBFormSelectList DonationSelectList">
<option selected="selected" value="8">General Unrestricted Fund</option>
<option value="13">Corpus Fund</option>
<option value="24">Education Fund</option>
</select>
</td>
</tr>
Thanks in advance,
Naveen
The script tag is processed by browser at the moment it appears in the HTML, the code is executed at that very moment. To postpone the execution, you should bind the code you've written to later event, like page load:
$(document).ready(doStuff);
Also, your function seemingly needs to be called everytime when first element is changed. So you need to bind it to change event of this element as well.
$('#donation_campaign').change(doStuff);
put these two lines at the end of your script.
At first, simplest solution is to have updateEverything javascript function that calculates all dependencies and modifies all necessary elements on the page, ensuring everything is correct. And you call this function at the page load and at changing of any element that is involved in dependencies tracked.
I successfully created tables with style that salesforce provided. (like the one that highlighted on mouseover etc)
But I want the value of column to be a link to display detail info of the object.
When I don't create my own visualforce page, the table looks nice and the column
values (records) are all hyperlinked but can't figure out how to do it from visualforce apex code.
pageBlockTable and column definition does not seem to have attributes or anything that
make it hyperlink.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_pageBlockTable.htm
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_column.htm
<apex:pageBlock title="test">
<apex:pageBlockTable value="{!workObj}" var="item">
<!-- below needs to be hyperlink -->
<apex:column value="{!item.name}" />
</apex:pageBlockTable>
</apex:pageBlock>
I could achieve my goal by throwing the good design away like below but I would like to keep the code above.
This works but no salesforce style is applied.
<apex:pageBlock title="my test title" >
<apex:dataTable value="{!workObj}" var="wn" cellpadding="2" cellspacing="2">
<apex:column>
<apex:facet name="header">仕事名一覧</apex:facet>
<apex:form >
<apex:commandLink value="{!wn.name}" />
</apex:form>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
Instead of <apex:column value="{!item.name}" />, try doing it like this in the column body:
<apex:pageBlock title="test">
<apex:pageBlockTable value="{!workObj}" var="item">
<apex:column>
<apex:outputLink value="{!item.name}">{!item.name}</apex:outputLink>
</apex:column>
<apex:pageBlock title="test">
<apex:pageBlockTable value="{!workObj}" var="item">