I am trying to add some text before each Proformtext component, but it is not appearing
Below is my code
<ProFormFieldSet
name="firstrow"
label={<span style={{fontSize: fontSize}}>A</span>}
labelAlign={labelAlignment}
>
<ProFormText
addonBefore="helloworld"
labelAlign={labelAlignment}
width="md"
/>
=
<ProFormText
addonBefore={C}
width="md" />
</ProFormFieldSet>
This is the Actual result
Expected Result
There is text beside each input.
What I have tried
I took ProFormText component out from ProFormFieldSet and the text appear. anyone know why this is happening??
according to the reference, the props we set for ProFormText are actually for Form.Item, and the fieldProps are for the included Input, remember. pro-form-fields-reference
have a try like below
<ProFormFieldSet
name="firstrow"
label={<span style={{fontSize: fontSize}}>A</span>}
labelAlign={labelAlignment}
>
<ProFormText
fieldProps={{addonBefore:"helloworld"}}
labelAlign={labelAlignment}
width="md"
/>
=
<ProFormText
fieldProps={{addonBefore: C}}
width="md" />
</ProFormFieldSet>
Related
I am developing a WPF application for arabic users using vb .net.
In the application the user has to enter in a textbox the following: "22/85/39" but unfortunately after entering it, it displays the reverse (i.e. 39/85/22).
This is my xaml code:
<TextBox x:Name="txtWorkingNumber" Height="26" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200"
Text="{Binding WorkingNumber}"
FlowDirection="RightToLeft"
Language="ar-SA"
NumberSubstitution.Substitution="AsCulture"/>
I have tried all Substitution enumerations but failed to find the fix.
Could any one give me a help on how to fix it??
many thanx...
Finally I found the solution which is, to add white space at the end of the text where you type "/" sympole. This is achieved through this code snippet added to the code behind:
Private Sub TextBox_PreviewKeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs)
Dim myTextBox As TextBox = CType(sender, TextBox)
If Thread.CurrentThread.CurrentCulture.ToString.StartsWith("ar") Then
If e.Key = System.Windows.Input.Key.Divide Then
myTextBox.Text += " "
myTextBox.CaretIndex = myTextBox.Text.Length
End If
End If
End Sub
I have a problem. I am trying to save a information into the database, and before that I check some conditions like if-else like:
if(condition){
//Some Action
}else{
getFacesContext().addMessage(null,MessageFactory.getMessage(ResourceBundle.FACES_BUNDLE.getName(), FacesBundle.LANDLINE_NUMBER_SHOULD_BE_TEN.getName()));
getExternalContext().getFlash().setKeepMessages(true);
return;
}
and When the condition does not match I would like to restore the previous values of the input field.
In that case, it was 22 in place of ss. but the field does not take input except numbers. So the validation fails and shows an message Invalid Input via growl.
How can I also reset the value of the field ss to 22 in java?
Please suggest!
You can use default validator that comes with JSF
<p:inputText id="number" value="" label="Number">
<f:validateDoubleRange minimum="0" maximum="99" />
</p:inputText>
<p:message for="number" />
But if you reset the filed with old value, user may not know what he's entered. However you will not submit until validation success.
Since the input text component implements EditableValueHolder you can call EditableValueHolder.resetValue() on the input component (or call the more convenient RequestContext.getCurrentInstance().reset(inputTextId)) and then re-render it by calling RequestContext.getCurrentInstance().update(inputTextId) if it isn't already being re-rendered through the update attribute of p:ajax.
I am working on a Firefox extension. I have a simple single-line textbox. When a user pastes in text, I want to detect if the text has newlines and if it does, I want to expand the textbox into a multiline textbox.
I have
<textbox id="textbox" rows="5" wrap="off" newlines="pasteintact" oninput="adjustTextbox(this)" flex="1"/>
and on the JS side, I have
adjustTextbox(txtBox) {
if(!txtBox.getAttribute('multiline') && txtBox.value.match(/[\r\n]/)) {
txtBox.setAttribute('multiline', true);
}
}
The problem is that, while the textbox does get converted to a 5 row multiline textbox, the value that is pasted in is lost and the textbox is blank. Am I doing something wrong here?
Short answer: no, you aren't doing anything wrong, the value is expected to be cleared when you switch from single-line to multi-line. Long answer: the <textbox> element doesn't actually hold the value itself, it rather contains an anonymous <html:input type="text>. When you add the multiline attribute a different XBL binding applies to the element and that anonymous text field is replaced by <html:textarea>. Obviously, the value gets lost in the process.
You could try to save the value and to restore it after you add the multiline attribute. The problem is that it is hard to tell when the binding actually applies, there is a delay that is not really predictable. So the better solution would be to have both a single-line and a multi-line text box in your document and make sure that one of them is always collapsed:
<textbox id="textbox" newlines="pasteintact" oninput="adjustTextbox(this)" flex="1"/>
<textbox id="textbox2" collapsed="true" multiline="true" rows="5" wrap="off" flex="1"/>
And on the JavaScript side:
function adjustTextbox(txtBox) {
if(!txtBox.getAttribute('multiline') && txtBox.value.match(/[\r\n]/)) {
var txtBox2 = document.getElementById("textbox2");
txtBox2.value = txtBox.value;
txtBox.collapsed = true;
txtBox2.collapsed = false;
}
}
Below is my Code:
<ui:repeat var="status" value="#{showUpdatedAction.statusUpdates}">
<h:panelGroup>
#{status.content}
<h:form>
<h:commandLink value="Like" action="#{statusAction.likeStatus(status.id,1)}" />
</h:form>
</h:panelGroup>
<ui:repeat>
#{status.content} shows correct values. When I print id of status using #{status.id}, it also gives correct value. But when I click the command link, value passed is always 0 for status.id.
Can someone tell me why this happens and how can I avoid this?
Thank you.
Edit 1
Interestingly, when instead of passing the parameter in function, I pass it using <f:param>, it works perfectly. Can anyone comment on that?
I think you should try using <c:forEach> instead of <ui:repeat>.
I can't tell you exactly, why status.id is 0 in your case but you can directly pass the whole status object in your EL expression. Like so:
<h:commandAction value="Like" action="#{statusAction.likeStatus(status)}" />
Then in your likeStatus you simply do a int statusId = status.getId() or similar and you have what you want.
As an addition: Using <c:forEach> should actually be just a fallback, because people say you shouldn't mix JSTL with JSF for whatsoever reasons.
Your code in the JSF page is just fine, just checked it... (generated the beans at my side too : showUpdatedAction, statusAction , and a simple class Status)
public void likeStatus(String id,long someVal){
System.out.println(id+"___"+someVal);
}
which prints the ids just fine
id1___1
id4___1
Maybe its something to do with the type of the id or something with your beans?
<s:TextInput id="bill" x="150" y="17" width="223"
borderColor="#FFFBFB" borderVisible="false"
color="#EF4315" contentBackgroundColor="#100101"
enabled="false" fontWeight="bold" restrict="0-9"
text="0.00" textAlign="right"/>
"0-9" restricts my textInput field to numeric values
and a decimal point. Is there a way I can extend this so only
two places follow the decimal?
Unfortunately you can not. But you can listent to CHANGE Event and programmatically force this on the TextInput.