Struts 1 Nested tags: getting unexpected html - struts

I am working on an old application using Struts 1. We are using nested tags. For below code:
<nested:form action="/save.do?method=save">
<h2>Indexed Property Example</h2>
<nested:iterate property="lines" indexId="idx">
Name: <nested:text property="name" indexed="true"/>
Town: <nested:text property="town" indexed="true"/>
<nested:iterate property="inches" indexId="j">
Inch: <nested:text property="length" indexed="true"></nested:text>
</nested:iterate>
</nested:iterate>
<nested:submit value="save" />
</nested:form>
I am getting below html:
<h2>Indexed Property Example</h2>
Name: <input name="nestedForm[0].lines[0].name" value="" type="text">
Town: <input name="nestedForm[0].lines[0].town" value="" type="text">
Inch: <input name="nestedForm[0].lines[0].inches[0].length" value="0" type="text">
Inch: <input name="nestedForm[1].lines[0].inches[1].length" value="0" type="text">
<input name="" value="save" type="submit">
If you see in second Inch label we have nestedForm[1] it should be 0. I have to change to this data and submit back to server. If I change it directly in html struts populate all objects automatically. Can anyone suggest me if I am doing anything wrong here.

Related

Element not being disabled

I have previously successfully implement this behaviour but for some reason it's not working. I am fairly new to Vue.js and I might be missing something.
I have two radio buttons as such:
<div class="radio">
<label>
<input type="radio" name="loginRadio" id="frmLoginRadio" value="true" v-model="loginRadio" checked>
No, I am new to this site
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="loginRadio" id="frmRegisterRadio" value="false" v-model="loginRadio">
Yes, my password is:
</label>
</div>
They both have a v-model of loginRadio which is initially set to false. When the second radio button is clicked, the disabled input button below should be enabled again.
<input type="password" class="form-control" name="password" :disabled="loginRadio">
However, for some reason, the only thing that is happening is this (when I used Chrome Debug)
<input type="password" class="form-control" name="password" disabled="false">
and the element stays disabled. What am I doing wrong?
You did not use v-bind:for the value attribute of the input buttons
Therefore, loginRadio does not contain boolean values true or false (depending on selection), but strings: "true" and "false"
it should be enough to properly bind the value attribute on both input buttons:
:value="true"
:value="false"

Products default sort not working on search.tpl - Prestashop 1.6.0.6

I set up in backoffice the default sort type to : in stock. this works for all pages except SearchController template file : search.tpl.
What can be the causes behind such dysfunctionning? I really don't know what part of code to deal with. Thanks everyone who already met such issue for advices.
Edit:
I discovered that the link in the adress bar after click on search button is:
website/index.phpcontroller=search&orderby=position&orderway=desc&search_query=design+40&submit_search=Rechercher
When I remove orderby=position&orderway=desc, the default behaviour works. I just need to remove this action from controller but still don't know how.
In template file, I found:
<form method="get" action="{$link->getPageLink('search')|escape:'html'}" id="searchbox">
<p>
<label for="search_query_top"><!-- image on background --></label>
<input type="hidden" name="controller" value="search" />
<input type="hidden" name="orderby" value="quantity" />
<input type="hidden" name="orderway" value="desc" />
<input class="search_query" type="text" id="search_query_top" name="search_query" value="{$search_query|escape:'html':'UTF-8'|stripslashes}" />
<input type="submit" name="submit_search" value="{l s='Search' mod='blocksearch'}" class="button" />
</p>
</form>
As you see, I have already changed the value of the hidden input to quantity. Hope it helps.

Submit a method in webbrowser

I have a problem invoking a submit method in web page
This is my code
Webbrowser.document.forms(0).invokemember("submit")
It does nothing.
Here is the html
<form name="myWebForm" action="myServerSideScript.php" method="post">
<input type="checkbox" /> Checkbox 1<br />
<input type="text" /> Text Field 1<br />
<input type="submit" value="SUBMIT" />
</form>
You must set .AllowNavigation property to "TRUE"
Webbrowser.AllowNavigation = True
And call submit method like this
Webbrowser.Document.Forms(0).InvokeMember("submit")
Or
Webbrowser.Document.Forms.GetElementsByName("myWebForm").Item(0).InvokeMember("submit")

skip radio buttons when posting the form

I have a rails from inside that I have some radio buttons which I don't want to post in my Edit action.
<form accept-charset="UTF-8" action="/feedbacks/3" id="edit_feedback_3" method="post">
<input id="1_1" name="1" type="radio" value="1" />Yes
<input id="1_1" name="1" type="radio" value="1" />No
<input id="feedback_answers" name="feedback[answers]" size="30" type="text" />
<input name="commit" type="submit" value="Submit" />
</form>
and these radio buttons are not bound to a model's attributes, How can I POST only the 'feedback_answers' to server.
All this is because I'm facing this issue with radio buttons
I'm using ruby 1.9.2 and rails 3.2.6.
A good way to handle this is to disable the radio buttons with javascript on submit:
function disableButtons() {
document.getElementById('1_1').setAttribute('disabled', 'disabled');
return true;
}
Then add the following in the form:
onsubmit="return disableButtons()"

How to render a Zend_Form_Element_MultiCheckbox form an array?

I need to render a MultiCheckbox like below:
Wanted:
<label>
<input type="checkbox" name="privacy[read_only]" value="1" /> Just for read only
</label>
<label>
<input type="checkbox" name="privacy[is_pulic]" value="1" /> Is public
</label>
How can I do that? I just can do with:
Unwanted:
<label>
<input type="checkbox" name="privacy[]" value="read_only" /> Just for read only
</label>
<label>
<input type="checkbox" name="privacy[]" value="is_pulic" /> Is public
</label>
Thanks so much for any your ideas.
If there was nothing else in your form, or you didn't mind each form element having the same format, you could use setElementsBelongTo($array) which is a method on a Zend_Form.
You might also then have to use individual checkboxes to acheive the desired markup, so this may or may not work in your scenario.