jsp iterator over list to get specific id - list

I have below code to iterate over the list to get the radio button populate:
<s:iterator value="custData.custList" id="custNameDetail">
<li>
<s:radio name="custname" list="#{'':custName}" ></s:radio><s:property value="DescriptioMess"/>
</li>
</s:iterator>
Its working perfectly but I want to disable the first radio button. How can I iterate through list to get the specific ids and disable the first radio button?
I am getting below as the output while running the above code for all elements:
<input type="radio" name= "custname" id="custname" checked="checked" value>
I think the problem lies here. I should get the different ids for all and then only I can add disabled="disabled" for the first id.
Please let me know if you guys have come across this issue and you have any suggestions.
Thanks for all your help.

Wasn't working with JSPs for few years but isn't the syntax for variables ${variable}? Like ="${someStruct.id}"?
Posting your Java code may help to put specific answer...

What you can do is add a status variable that will give you information about the loop iteration you are on.
So you can do something like this
<s:iterator value="custData.custList" id="custNameDetail" status="loopStatus">
<li>
<s:if test="#loopStatus.first == true"> //make it disabled
<s:radio name="custname" list="#{'':custName}" ></s:radio><s:property value="DescriptioMess"/>
</s:if>
<s:else>
<s:radio name="custname" list="#{'':custName}" ></s:radio><s:property value="DescriptioMess"/>
</s:else>
</li>
</s:iterator>
See here for more information.

Related

Ember's input helper need double click to edit in ie11

<div draggable="true">
{{input value="default value" }}
</div>
In ember.js, as above code, when the div element has an attribute 'draggable="true"', on the webpage, the input area must need a double-click to edit in ie-11, but in chrome or firefox, it just need a click event to edit. Has anyone resolved this issue?
seems to be a bug
[IE 11] Input field of type text does not respond to mouse clicks when ancestor node has draggable=true
bad workaround:
<div style="background-color:lightgray" id="dragE" draggable="true">
<input id="inputE" type="text" />
</div>
click on the lightgray background
now the input field support single click
$('#dragE').focus(); <br>
$('#inputE').focus();<br>
was my solution
unfotunately reproducing with pluncer & co. did not work.
Or...set attribute draggable to "false", when the page goes to a production environment.
This worked for us.

How to add and save entry in dropdown listbox using coldfusion

Id like to make a drop down list box where in at the end of the list, an option "Enter New housing", that if selected there will be a message box then it will automatically saves on the database and refreshes the object.
Im a beginner and this is what ive started:
<cfquery name="housingsel" datasource=" " dbtype=" ">
select rtrim(housing_name) as housing, housingid as housingid from housing order by housing
</cfquery>
<!---<cfquery name="housingins" datasource=" " dbtype=" ">
insert into housing (housingid,housing_name) values (1,'Tierra Pura Housing')
</cfquery>--->
<body>
<div class="container">
<div class="content">
<h1>Housing</h1>
<table width="300" bgcolor="#FFFFFF" cellpadding="2" cellspacing="0" border="0">
<cfform action="de_housing.cfm" method="POST">
<tr><td height="20" class="lbl" align="right">Housing</td><td>
<select name="housingcat">
<CFOUTPUT QUERY="housingsel">
<OPTION VALUE="#housingid#">#housing#</OPTION>
</CFOUTPUT>
<option value="new">Enter New Housing</option>
</select>
</td></tr>
<tr><td height="20" class="lbl"></td><td align="left">
</td></tr>
</cfform>
</table>
Please help!
Thanks!
First off, avoid cfform at all costs. It will not help you. See https://github.com/cfjedimaster/ColdFusion-UI-the-Right-Way for reasons why and examples of how to do stuff the right way.
That being said, what you want to do isn't difficult. Let's break it down.
> "Id like to make a drop down list box where in at the end of the list, an option "Enter New housing", that if selected "
Using jQuery, you would add a change handler to your dropdown. In that change handler, you can get the selected index of the drop down. If that index is equal to the length of the options, then the user has picked the last one.
> "there will be a message box"
You have a few choices here. One simple, but not pretty way, is to use the built in confirm option. It has a simple modal box API that the user can type in. There are pretty options, like jQuery UI dialogs, but the confirm option is super simple. I'd recommend starting there.
> "automatically saves on the database"
So, you will know when a user enters a value into the confirm. Take that and use jQuery to do an XHR (Ajax) hit to your code. You will need to write CF code to respond to this request and insert it into the db. Not too difficult and it has been shown many places elsewhere. I'd also add logic to check for dupes.
> "refreshes the object"
When you do a XHR in jQuery, you know when the server is done doing crap, so in the response handler, you can add a new option to the drop down. This too has been done many times before, just Google for adding an option to a drop down. (You will probably end up back here.)

Meteor.js template reactivity keep some data

Using meteor.js and i am kind of stuck with the structure of template or how to do this trick as clear as possible.
Example of my chating app problem:
chatingWith = DB query for selecting each user i am chating with like on FB // REACTIVE
{{#each chatingWith}}
{{#each this.messages}}
Message1...
Message2...
{{/each}}
<form>
<input class="sendMessage" type="text" />
</form>
{{/each}}
This works exactly as i need but with one big problem... when new message arrive... the content is re-rendered ofc and when i am in this time writing a message the value of will dissapear.
How would you solve this?
Sorry for english and thx for tips!
There is a section in the documents about preserving inputs. http://docs.meteor.com/#template_preserve
From my understanding, as long as you have the package preserve-inputs installed, it should keep the reactive nature of meteor from erasing the input. I would check to see if the preserve-inputs package is installed.

can't add a link to an entire div section

I have a problem with TinyMCE in Joomla 2.5.4. I have tried for a few days now to add a link to a div section (like <div> something< </div> ) but failed, the anchor is stripped from the HTML section because TinyMCE sees that as being wrong in HTML4. After a 3 days research I gave up and instead of a div i used a unordered list.
Now when i try to add a link to a list item (like <li> <p> something </p> </li> ) TinyMCE rearranges everything and moves the anchor inside of the list item (like <li> <a href="#"> <p> something </p> &=lt;/a> </li>).
I have tried pretty much everything from valid_elements : "[]" to text filter: No Filtering but i ran low on ideas.
Can anyone please help me?
Try playing around with TinyMCE's html5 options: http://www.tinymce.com/tryit/html5_formats.php
Hit "view source" to see how they're doing it. It's mainly this option inside tinyMCE.init:
schema: "html5",

Inserting into DB in JPA in play Framework

I am finding difficult to display the template in play framework using groovy
#{list users, as:'user'}
<li>${user}</li>
#{/list}
#{list items:0..10, as:'i'}
${i}
#{/list}
How to combine the above 2 to display like this
My Name
Plays Name
Groovy Name
If I understand you correctly, this is pretty easy to achieve.
To do this in Groovy, using Play, You can simply do
#{list users, as:'user'}
<li>${user_index}. ${user}</li>
#{/list}
See the list tag for more details. http://www.playframework.org/documentation/1.2.2/tags#list
Obviously, you could have just done this with an OrderedList in HTML, using outside of the List tag, which by default in HTML will show a numbered list.
So, your code could simply be
<ol>
#{list users, as:'user'}
<li>${user}</li>
#{/list}
</ol>
No real idea of what your example output is meant to show, but I assume you have:
<ul>
#{list users, as:'user'}
<li>${user}</li>
#{/list}
</ul>
If you change it to <ol> instead of <ul>, you will get an ordered list with numbers:
<ol>
#{list users, as:'user'}
<li>${user}</li>
#{/list}
</ol>