Set text in Visual JSF textfield from javascript
HI,
I want to pass a variable from a javascript to put into a visual jsf textfield that is connected to a Bean variable like this:
<webuijsf:textField id="myLat" style="left: 96px; top: 336px; position: absolute" text="#{CreateNewPage.latitude}"/>
I use this library: xmlns:webuijsf="http://www.sun.com/webui/webuijsf"
I found a guide for this using regular jsf-tags, but that doesn't work for the visual jsf tags. Link: http://balusc.blogspot.com/2009/05/javajspjsf-and-javascript.html
I managed though to change the field to some sort of text by using:
var lat = 'text';
document.getElementById("form1:myLat").textContent = lat;
in my javascript. But this just replaces the textfield to some stand alone text, and the variable in my Bean isn't changed at all. I tried using .value and .text instead of .textContent but it doesn't work. What am I doing wrong here? I'm new to JSF by the way. Thankful for any help.
I've now read the article and understand everything better. Also funny that I got a reply from the author of it here :)
Sadly I have to use javascript I believe since I'm using a google maps api that uses it.
Anyway, I still can't get it to work properly.
now my jsp look like:
<webuijsf:form id="myForm">
<webuijsf:textField id="my2" style="left: 528px; top: 0px; position: absolute" text="#{EditPage.latFromMap}"/>
</webuijsf:form>
and in my JS:
document.getElementById("myForm:my2").text = 'text';
document.getElementById("myForm").submit();
I now get to the setLatFromMap() setter Method for my variable in my EditPage bean, but when I do a print out of it it's null. Also the textfield on my page becomes blank after the refreshing of the page. of Am I still missing some of the concepts? thx
Similar Messages
-
Visual JSf: textField hide or disable, when selecting dropDown list
Hello everyone,
I am new to this forum, I am working on Visaul JSF, I have a question,
When i select a value dropDown List, i want to disable or hide textField depending on the selected item in the list.
I have put javascript for dropDown list. I am not able to do this. Can any one help me please...
<webuijsf:script>
function fun(sel){
var state = sel.options[sel.selectedIndex].value;
alert(state);
if(state == 2){ alert("if"); document.getElementById('form1:textField2').disabled='true' }else{ alert("else"); document.getElementById('form1:textField2').disabled='false'}
</webuijsf:script>for downdown, i have added this..
onChange="fun(this)"In dropdon list
name value
One 1
Two 2
Three 3
Jsp code:
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<webuijsf:page id="page1">
<webuijsf:html id="html1">
<webuijsf:script/>
<webuijsf:script>
function fun(sel){
var state = sel.options[sel.selectedIndex].value * 1;
alert(state);
if(state == 2){ alert("if"); document.getElementById('form1:textField2').disabled='true' }else{ alert("else"); document.getElementById('form1:textField2').disabled='false'}
</webuijsf:script>
<webuijsf:head id="head1">
<webuijsf:link id="link1" url="/resources/stylesheet.css"/>
</webuijsf:head>
<webuijsf:body id="body1" style="-rave-layout: grid">
<webuijsf:form id="form1">
<webuijsf:textField id="textField2" onChange="" style="height: 18px; left: 174px; top: 258px; position: absolute; width: 216px"/>
<webuijsf:button id="button1" onClick="return fun()" style="position: absolute; left: 228px; top: 324px" text="Button"/>
<webuijsf:dropDown id="dropDown1" items="#{Page3.dropDown1DefaultOptions.options}" style="position: absolute; left: 312px; top: 90px" onChange="fun(this)"/>
</webuijsf:form>
</webuijsf:body>
</webuijsf:html>
</webuijsf:page>
</f:view>
</jsp:root>Thanks in advance
Neha
Edited by: Neha_540 on Apr 5, 2009 11:02 PM
Edited by: Neha_540 on Apr 5, 2009 11:05 PMHi Neha,
Hope this helps.
function changeMarital()
var marital = document.getElementById('form1:drpMarital_list').value;
if(marital == "Others")
document.getElementById('form1:lblOtherMarital').style.display='';
document.getElementById('form1:txtOtherMarital').style.display='';
else
document.getElementById('form1:lblOtherMarital').style.display='none';
document.getElementById('form1:txtOtherMarital').style.display='none';
} -
How to set property(variable) of jsf component in javascripts
Hi, i have a jsf page which has an outputText component and its value is bound with its backing bean. I want to set its value in a javascripts written in the same jsf page. i'm using the following code: but its not working....can anybody help me out ...
*document.getElementById('form:clicked').innerHTML = ' value ' ;*
*<h:outputText id="clicked" value="#{bean.outputText property}"*
*style="display: none"></h:outputText>*Hi, i have a jsf page which has an outputText component and its value is bound with its backing bean. I want to set its value in a javascripts written in the same jsf page. i'm using the following code: but its not working....can anybody help me out ...
*document.getElementById('form:clicked').innerHTML = ' value ' ;*
*<h:outputText id="clicked" value="#{bean.outputText property}"*
*style="display: none"></h:outputText>* -
Set Text to a frame.html from java
Hi everybody
This is my case:
i have a string (in java code) and i want to show it on a frame.html page
Do u have any ideas ????
help !!!!!
pls !!!!!It sounds like you might want to create a Java Server Page. Java Server Pages, or JSP's allow you to present information created dynamically within a static html page. The dynamic content, the Java String, would be enclosed within special tags.
You can learn more about JSP pages by visiting these links...
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
http://pdf.coreservlets.com/
http://java.sun.com/developer/technicalArticles/javaserverpages/JSP20/
http://java.sun.com/developer/technicalArticles/Programming/jsp/ -
Hi,
I`m getting error message like "None of the apps in your project can be activated in the target. The manifest file of one or more apps contain API sets or Office applications that are not supported by
the target Office client. To debug those apps, update manifest files to exclude any unsupported API sets or Office applications, and then start the project again. Alternatively, you can debug your apps by using Office 365 as a target." when when
updating the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1 in manifest file though i have added host elements.
any help in this regard is highly appreciated
Thanks,
Santosh SutarHi Satosh Sutar,
Based on the description, you got the error message when you update the apps from version 1.0 to 1.1.
From the error message, it seems the menifest include some settings no allowed in the new version. Would you mind sharing more detail about how you update the project?
And here is an article about updating apps for Office and menifest schema files in the project for your reference:
How to: Update the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Set Stroke Alignment from JavaScript
Hi,
I'm trying to set the stroke style for a path item I've drawn through JavaScript, however I can't find a way to set the stroke alignment for my path item.
I've checked the Illustrator JavaScript reference but I can't seem to find that option in there.
I would expect something like:
pathItem.strokeAlignment = StrokeAlignment.OUTSIDE; // This doesn't work, what is the correct way to set the stroke alignment from JavaScript?
If I change the option in the Actions Panel it comes up as 'Set Stroke/Alignment: Outside', so there must be an equivalent way of setting it from JavaScript.
Is there a way of converting Actions to JavaScript so you can see which properties and attributes are being set on the object?
Does anyone know the correct way to set the strok alignment from JavaScript?
Thanks!You can only call an action from JavaScript in CS6… (I don't have this). Up until then it was AppleScript and Visual Basic only…
Document raster effects you do have access to…
Class
RasterEffectOptions
The document raster effects settings.
Class
Property
Type
Access
Description
antiAliasing
bool
r/w
Should the resulting image be antialiased. (default: false)
clippingMask
bool
r/w
Should a clipping mask be created for the resulting image. (default: false)
colorModel
RasterizationColorModel:
RasterizationColorModel.DEFAULTCOLORMODEL
RasterizationColorModel.GRAYSCALE
RasterizationColorModel.BITMAP
r/w
The color model for the rasterization. (default: RasterizationColorModel.DEFAULTCOLORMODEL)
convertSpotColors
bool
r/w
Whether to convert all spot colors to process colors in the resulting image. (default: false)
padding
number
r/w
The amount of white space (in points) to be added around the object during rasterization. (default: 0)
resolution
number (range: 72.0 - 2400.0)
r/w
The rasterization resolution in dots-per-inch (dpi) (default: 300)
transparency
bool
r/w
Should the resulting image use transparency. (default: false) -
Set application item from javascript?
Hi!
Is it possible to set an APPLICATION ITEM from javascript? If so can some one please point me to the thread, or a FAQ or an example, etc?
Thanks!
Dave Venusdvenus1,
Sure. In the script below I check variables and populate based on what I find...
<script language="JavaScript" type="text/javascript">
function Populate_fld()
var formVehicle = document.getElementById('P9_HIDE_VEHICLE').value;
var formState = document.getElementById('P9_HIDE_STATE').value;
var formTag = document.getElementById('P9_HIDE_TAG').value;
var formName = document.getElementById('P9_HIDE_NAME').value;
document.getElementById("P9_VEHICLE").value = formVehicle;
document.getElementById("P9_TAG").value = formTag;
document.getElementById("P9_STATE").value = formState;
document.getElementById("P9_VISITOR_NAME").value = formName;
if (formState = " ")
document.getElementById("P9_STATE").value = "FL";
</script>
Keep Smiling,
Bob R -
I am trying to control the Flash player browser plugin from
Javascript.
- I need to set the start position to play, based on time.
example, setPosition(10 seconds)
However I notice that the flash player API is based upon
number of frames.
for example, the methods TotalFrames() and GotoFrame() are
based on frame number.
How do I convert it to time? I don't see a frame rate
variable.
I don't see a call to access this - but the duration of a
clip is always shown near the slider
- can I also query the duration from the player?
- I also need a callback into my Javascript object when an
event occurs - for example,
when the player stops playing because it is stopped by the
user. Should work on earlier versions than Flash 8.
Any help appreciated.
thanks,
Anilno replies?
-
Set text of layer problem (escaping ' and " in javascript)
Hi all
I am using the Dreamweaver behaviour "set text of layer" and
I am having problems with escaping
single AND double quotes in the javascript.
Because the text I want to set the Layer with contains some
javascript.
So the text of my layer contains both single and double
quotes.
I can escape the single quotes like this:
But I can't escape the double quotes the same way for some
reason.
even if I use \" javascript thinks it's the end of the
javascript function.
So I have tried using " in the javascript of the
text to set, but strangely, although it works
in Safari, it does not work in FireFox and IE.
When I mouse over my javascript link set in the layer, the
browser status bar shows the right thing
in Safari, but in IE and FireFox, it shows extra double
quotes...
onClick="MM_setTextOfLayer('list','','<a
href="javascript:;"
onClick="MM_showHideLayers(\'options\',\'\',\'show\')">designers</a>')"
Anybody knows the answer to this one?
seb ( [email protected])
http://webtrans1.com | high-end web
design
Downloads: Slide Show, Directory Browser, Mailing ListWhat about using the " entity? That *should* work.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"(_seb_)" <[email protected]> wrote in message
news:[email protected]...
> doubling the quotes did not work.
> But I solved the problem by removing the quotes all
together:
>
> onClick="MM_setTextOfLayer('list','','<a
href=javascript: ...
>
> that does it!
>
> Randy Edmunds wrote:
>> Try doubling the quotes to escape them, for example:
>>
>> onClick="MM_setTextOfLayer('list','','<a
href=""javascript:"" ...
>>
>> HTH,
>> Randy
>>
>>
>>> I am using the Dreamweaver behaviour "set text
of layer" and I am having
>>> problems with escaping single AND double quotes
in the javascript.
>>>
>>> Because the text I want to set the Layer with
contains some javascript.
>>>
>>> So the text of my layer contains both single and
double quotes.
>>>
>>> I can escape the single quotes like this:
>>> \'
>>> But I can't escape the double quotes the same
way for some reason.
>>> even if I use \" javascript thinks it's the end
of the javascript
>>> function.
>>>
>>> So I have tried using " in the
javascript of the text to set, but
>>> strangely, although it works in Safari, it does
not work in FireFox and
>>> IE.
>>> When I mouse over my javascript link set in the
layer, the browser
>>> status bar shows the right thing in Safari, but
in IE and FireFox, it
>>> shows extra double quotes...
>>>
>>> onClick="MM_setTextOfLayer('list','','<a
href="javascript:;"
>>>
onClick="MM_showHideLayers(\'options\',\'\',\'show\')">designers</a>')"
>>> Anybody knows the answer to this one?
>
>
> --
> seb ( [email protected])
>
http://webtrans1.com | high-end web
design
> Downloads: Slide Show, Directory Browser, Mailing List -
Set text of container - javascript help, please!
I have used Dreamweaver behaviours to "Set text of container" and make different writing appear inside a box when I click a hotspot. Now I want people to be able to click on the writing that just appeared and make more text appear in another box. Could someone tell me how to do this? I don't think I can use Dreamweaver's behaviours for this because there's no material trigger... in that the writing that is the trigger only appears when the first trigger is clicked, but I'm more than happy to be corrected!!
So, I've been trawling through javascript libraries but I don't know what I'm doing, so if someone could either tell me how to do this in dreamweaver or really spell out what libraries etc. I need to download and what code I need to make a bit of text that's already a set text of a container into a trigger for a set text of another container, that would be great!
Sorry for the complicated question, it's difficult to explain what I mean.
All help very much appreciated ^^flozzle19262010 wrote:
I... really don't see how that will help you, considering I'm just asking HOW to do something. It's not like there's a mistake in my CSS or whatever, I just want to know if such a thing as described above is possible...
As I say, I'm reluctant to upload it as it's for someone else.
Have a look here http://forums.adobe.com/message/2691056#2691056.
Both Nancy (one of the best in the business) and I have been trying to help. It's your call.
I wish you the best of luck.
Ben -
I have three "div" tags in index.jsp ,
<div id='header'></div>
<div id='body'></div>
<div id='footer'></div>
Now when window is loaded i want other jsp page to be set in the "body" div tag of index.jsp from javascript
My javascript code
function invokeJSP(){
document.getElementById('body').innerHTML="<jsp:include page='test.jsp'>'";
when I am including this code in <head > part of index.jsp its working the problem is if at all
In test.jsp
if i try to include this line
<% = request.getParameter("name")%>
its giving an error like "unterminated literal string" in javascript console
Can anyone help me how to set the jsp from javascript
Sorry for my bad english.This is the first time I am posting the forum
thanks
hemahi
Thanks for the response
but i have closed the tag in my program. Have u ever tried to invoke jsp from javascript in this way if it works plz help me.
thanks hema -
I have a global variable: lossPayees
I have a function that is called by the "click" event of a button:
payeeButton.clickIncrement(this);
This funtion is intended to perform 2 tasks:
1) change the caption on the button
2) change the toolTip on the button
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function clickIncrement(oButton) {
var capTxt = "";
var txtIndex = 0;
var ttTxt = "";
if (oButton.caption.value.text.value < lossPayees.value) {
capTxt = String(1 + parseInt(oButton.caption.value.text.value));
oButton.caption.value.text = capTxt; }
// so far, so good--everything works perfectly--more hoops to jump thru than you might expect--but the button caption changes/increments perfectly
// but now is where the trouble begins--I want to continue with this funtion and have it change the button's toolTip
// 3 line of code are added:
if (oButton.caption.value.text.value < lossPayees.value) {
capTxt = String(1 + parseInt(oButton.caption.value.text.value));
oButton.caption.value.text = capTxt;
txtIndex = parseInt(capTxt, 10) - 1; //create an index
ttTxt = String(txtIndex); //convert the index into a string
oButton.assist.toolTip.value = ttTxt; //feed it to the toolTip
//now this works--but it is not the goal--you can actually assign any string to the variable ttTxt and it works
//however--I want to fill the toolTip with text from a text field (using reference syntax):
function clickIncrement(oButton) {
var capTxt = "";
var txtIndex = 0;
var ttTxt = "";
if (oButton.caption.value.text.value < lossPayees.value) {
capTxt = String(1 + parseInt(oButton.caption.value.text.value));
oButton.caption.value.text = capTxt;
txtIndex = parseInt(capTxt, 10) - 1; //create an index
ttTxt = xfa.resolveNode("Page1.SubformLP.TableLP.TableSectionLP[txtIndex]").Row1.TxtLP.rawValue; //use the index
oButton.assist.toolTip.value = ttTxt; } //feed to toolTip
else {
oButton.caption.value.text = "0";
oButton.assist.toolTip.value = "None"; }
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I don't get any errors--the toolTip acts like that part of the script doesn't exist. The button shows the new caption and the tooTip also shows the new caption (which is the default, I believe), instead of the text from the text field. Normally you'd expect an error from JavaScript saying it can't find the referenced object--but I don't get anything like that. BTW: using Designer ES2 9.0
Maybe the toolTip part of the script should be separated from the caption part (creat an additional function) and perhaps on a different event? Like I said, It works if I feed it a string--just won't work with reference syntax? I don't get it.
Any insight? Thanks in advance!
StephenAll the code above isn't rendering on my browser--although I see it in the HTML source! What a mess. Try this:
function clickIncrement(oButton){
var capTxt = "";
var txtIndex = 0;
var ttTxt = "";
if (oButton.caption.value.text.value < lossPayees.value) {
capTxt = String(1 + parseInt(oButton.caption.value.text.value));
oButton.caption.value.text = capTxt;
txtIndex = parseInt(capTxt, 10) - 1;
ttTxt = xfa.resolveNode("Page1.SubformLP.TableLP.TableSectionLP[txtIndex]").Row1.TxtLP.rawValue;
oButton.assist.toolTip.value = ttTxt; }
Else {
oButton.caption.value.text = "0";
oButton.assist.toolTip.value = "None"; } -
Each time I use Firefox, the message "Uninstall Set" keep popping up from Javascript (not Java). I can not use Firefox because this keeps popping up.
That would be from an extension, anything similar from Firefox would have been cleaned up. If you'd been on 4.0.1 for a while and it just started happening, then I'd try Tools > Add-ons > Extensions then on the gear wheel choose "View Recent Updates" the date will appear the list small and the. The "last updated" button near top right does something mysterious.
To see list in normal fashion again choose "Appearances" then return to "Extensions".
If you dislike the formatting of the Add-ons list during normal viewing you can improve it tremendously with a custom style:
* [https://addons.mozilla.org/firefox/addon/stylish/ Stylish :: Add-ons for Firefox]
* [http://userstyles.org/styles/42112/firefox-4-compact-addons-manager Firefox 4 - Compact Addons Manager - Themes and Skins for browser - userstyles.org]
From the wording the message could possible be referring to a Collection of Extensions. I avoid collection sets like the plague.
Also see related answer
* [https://support.mozilla.com/en-US/questions/824098 i keep getting a pop up saying uninstall set | Firefox Support Forum | Firefox Help] by Cor-el. -
How to Set the Text of an Onstage TextField?
I'm trying to set an onstage TextField instance's "text" property, while maintaining embedded fonts and its onstage appearance.
Problem Encountered: Text doesn't show up when setting text via ActionScript on an on-stage TextField w/ embedded text.
Workaround: Create and assign a TextFormat object:
defaultTextFormat = new TextFormat('Arial', 100, 0x000000, true, true);
Annoyance: This defeats the purpose of styling text with the IDE.
Possible Solution: Import the embedded font to the library and export for ActionScript?My problem was actually that merely setting the *text* property caused my dynamic TextField w/ embedded font to not display any text. BUT, I just re-tested this with a new file, and the problem doesn't occur. Only thing I can think of is -- my FLA was created with an older version of Flash... possibly MX 200(4?). Could this be the issue?
-
Retrieve data passed in session from another application in visual jsf
hi,
I'm using jboss 4.2.2, visual jsf, etbeans 6.0.1
My application needs to read the data passed in session from the calling application.
i try to get it using the below in init()
HttpServletRequest request=(HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
String value=(String) request.getAttribute("id");
System.out.print(value);
But it always prints null.
any idea??
Thanks.Hi,
My value is still null.
I created a simple web application. In the jsp page, ==>
<form method="post" action="http://localhost:8080/MyApp/">
<input type="hidden" name="username" value="ME"/>
<input type="submit" value="Submit" name="Submit"/>
</form>
In MyApp, which is a Web application with Visual JSF, in the welcome file init() method, i get the values ==>
String value = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("username");
System.out.print("request value in welcome page init() = " + value);
Fearing loss of data by request, i tried in session too. But no luck.
Maybe you are looking for
-
Query to get Week number Pls help
I need to get week number of the current year in the format 2008-W47 ( this is for sysdate when i try select to_CHAR(sysdate,'YYYY'||'-IW') FROM DUAL i get 2008-47 but in the format 2008-W47 Help s
-
Using a Stored Procedure with the DBUM connector
Hello, I am a new to the Oracle Identity Manager. The system I am running on is Windows Server 2008. I have recently installed version 11.1.1.3.0 of the Identity and Access Management suite, along with the appropriate components. I am using an 11g R2
-
Adding vendor field in Q3 type of notification.
Dear Friends, We are using ECC6.00 (EHP4). QM module is also implemented and used. For one of our requirement, we want to add the vendor field in the Q3 Notification as it is available in Q2. I tried the customising setting, but when i create the not
-
SAP 4.7 Unicode Installtion
When installing SAP 4.7 Unicode Version on Windows 2000 Adv Server + MS SQL 2000 Server.I am getting following error, ================= myCluster (3.5.Imp): 1329: inconsistent field count detected. myCluster (3.5.Imp) : 1329 : inconsistent field coun
-
Minimum set of oracle jar libraries for JMS Streams
In the installation manual there is a list of jars that I have to have in a classpath in order to use Advance Queueing. $ORACLE_HOME/jdbc/lib/classes12.jar $ORACLE_HOME/jdbc/lib/orail8n.jar $ORACLE_HOME/jdk/jre/lib/ext/jta.jar $ORACLE_HOME/jdk/jre/li