Loading foreach using core methods in ZK MVVM - zk

I would like to read some values from my vm. Here's an example of what I've done so far
<div forEach="${vm.activityData.activityList}">
<label
value="#load(c:cat3('vm.activitiData.', each, '.organizer' ))" />
</div>
But it seems like it is unable to read the each inside the cat3. My objective is to get the organizer for each activity. Any idea how to achieve this ?
Update
For example, I want to simplify from this codes :
<div>
<label value="#load(vm.activityData.A.name)" />
<label value="#load(vm.activityData.ASponsor)" />
<label value="#load(vm.activityData.AOrganizer)" />
<separator/>
<label value="#load(vm.activityData.B.name)" />
<label value="#load(vm.activityData.BSponsor)" />
<label value="#load(vm.activityData.BOrganizer)" />
<separator/>
</div>
into
<div forEach="${vm.activityData.activityList}">
<label value="#load(c:cat3('vm.activityData.', each, '.name'))" />
<label value="#load(c:cat3('vm.activityData.', each, 'Sponsor'))" />
<label value="#load(c:cat3('vm.activityData.', each, 'Organizer'))" />
<separator/>
</div>
Basically what I want to do is to dynamically combine part of strings into one string. And then use #load(string).

Today I had the time to test it and I prepared a fiddle for you.
Your ZK version is good but I did forget to add one more thing.
You have to make use of the custom-attributes otherwise it wouldn't work.
Solution :
<div forEach="${vm.activityData.activityList}">
<custom-attributes field="${each}"/>
<label value="#load(vm.activityData[field].name)" />
<label value="#load(vm.activityData[c:cat(field, 'Sponsor')]" />
<label value="#load(vm.activityData[c:cat(field, 'Organizer')]" />
<separator/>
</div>
I created fast a working fiddle where you can test or look how it works.

Related

Modifying TYPO3 form.checkbox hiddenfield

When the following code is added to a partial HTML class in TYPO3.
<f:form.checkbox id="myCheckBox" property="myCheckBox" value="Y" multiple="no" />
When the form is loaded within a TYPO3 extension the following code is generated for the checkbox
<input type="hidden" name="form[newForm][myCheckBox]" value="" />
<input id="myCheckBox" type="checkbox" name="form[newForm][myCheckBox]" value="Yes" />
Is there a way of adding the parameter ID to the auto generated hidden field so we have:
<input type="hidden" id="myCheckBoxHidden" name="form[newForm][myCheckBox]" value="" />
<input id="myCheckBox" type="checkbox" name="form[newForm][myCheckBox]" value="Yes" />
Using TYPO3 7.6.13
I think you could extend the CheckboxViewHelper and add the id attribute as you needed, and then use your new VH instead.

Visual Studio Code HTML Format doesn't work

In Visual Studio Code (ver. 1.12.0) Format Document seems not to work.
I tried with shortcut, with context menu but the result is always the same.
For example I have this line:
<div class="form-group"> <label for="comment"> </label> <textarea name="" id="comment" cols="30" rows="10" class="form-control"> </textarea></div>
the result is simply this:
<div class="form-group"> <label for="comment"> </label> <textarea name="" id="comment" cols="30" rows="10" class="form-control"> </textarea></div>
It only removes some space before the label element!

DHTMLX SCHEDULER

[enter image description here][1] I want to add Time period section to fully custom light box.
[<form id='form1'>
<span class="label">Text</span><input id="Text1" name="text" type="text"/><br />
<span class="label">From</span><input id="start_date" name="start_date" type="text"/>
<span class="label">to</span><input id="end_date" name="end_date" type="text"/><br />
<span class="label">Room_id</span><input id="Text4" name="room_id" type="text"/>
<span class="label">User Id</span><input id="Text5" name="user_id" type="text"/>
<input type="text" id="patient_name" name="patient_name"/>
<input type="text" id="patient_dob" name="patient_dob"/>
<input id="Hidden1" name="id" type="hidden"/>
</form>][1]
[1]: SEE this Image https://i.stack.imgur.com/A3spf.png
It shouldn't be very difficult
you need to find a date-time picker component that works for you
(datepicker embedded into dhtmlxScheduler lacks time-picker
functionality)
when user opens lightbox - you initialize datepickers in form inputs and assign event.start_date/end_date into them
when user saves lightbox - you get values from datepickers and update event.start_date/end_date with those values.
Here is a demo - http://docs.dhtmlx.com/scheduler/snippet/5e45f342
I used this example https://docs.dhtmlx.com/scheduler/samples/02_customization/16_custom_form.html and flatpickr datepicker https://chmln.github.io/flatpickr/ for it.

Aligning inputs on bootstrap using the Fluid Grid System

I am creating a form that requires the user to input their name and email address. The first line of the form has two inputs side by side for each part of the name and the 2nd line has one input for the email address that should be the same width as the first line combined. I'm trying to use the fluid grid system but can't line up the 2nd row with the first.
<form action="/subscriptions" method="post">
<fieldset>
<div class="control-group">
<label class="control-label" for="name">Name</label>
<div class="controls row-fluid">
<input class="span2" id="first_name" name="first_name" placeholder="First" required="required" type="text">
<input class="span2" id="last_name" name="last_name" placeholder="Last" required="required" type="text">
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls row-fluid">
<input class="span4" id="email" name="email" type="email">
</div>
</div>
</fieldset>
</form>​
http://jsfiddle.net/sguha095/v4amX/
Have a look a this jdfiddle: http://jsfiddle.net/kY5LL/18/
I added some div.row-fluid containers per row of your form and one extra set of inputs for demonstration.
Hope this is what you were looking for.
First we need to clean up the HTML a bit, there is an extra closing div on the first line.
I just added some classes to improve the styling so you could see how it works. The input-block-level class is a bootstrap mixin to force inputs to act like true block level elements. That's needed if you want this to be clean and to leverage the benefits of CSS. If you want to do all of your styling with HTML, then you can do so with more markup and less semantic methods, but I would recommend against it.
Hope this helps!
http://jsfiddle.net/kY5LL/12/

Strange JSP behavior while rendering a form in a forEach loop

i found a strange behavior in my JSP site and hope somebody have a good advice for me:
JSP-Code:
<c:forEach items="${info.moneyList}" var="mmRoles" varStatus="uStatus" >
....
<div class="paperback" id="delete_${uStatus.index}">
<form id="deleteMoneyMarketSpread_${uStatus.index}"
action="deleteMoneyMarketSpread" method="post">
<input type="hidden" name="currency"
value="${mmRoles.currency}" />
<input type="hidden" name="loan"
value="${mmRoles.loan}" />
<input type="hidden" name="lcfspread"
value="${mmRoles.lcfspread}" />
</form>
</div>
....
</c:forEach>
I generate a form element with hidden input fields in a forEach loop. The interesting point is that (only) in the first iteration no form element will be created. When i check the HTML code with Firebug i only find the hidden input fields, but no surrounding form tag.
HTML code:
<!-- first iteration -->
<div id="delete_0" class="paperback">
<input type="hidden" value="EUR" name="currency">
<input type="hidden" value="true" name="loan">
<input type="hidden" value="123.0" name="lcfspread">
</div>
...
<!-- second iteration -->
<div id="delete_1" class="paperback">
<form id="deleteMoneyMarketSpread_1" method="post" action="deleteMoneyMarketSpread">
<input type="hidden" value="FGH" name="currency">
<input type="hidden" value="true" name="loan">
<input type="hidden" value="1.0" name="lcfspread">
</form>
</div>
Have anyone an idea why this happens?
Regards
Sascha
I still don't found a solution or a reason for this so i used a workaround an create my Form on demand with javaScript when clicking the icon. Not the best way but it works.