Validating the htmlb inputfield using javascript
Hi,
I am trying to validate the htmlb inputfiels using the javascript,i want to get the value entered iin this inputfield in the javascript in order to validate
plz help me on how do i get the value of the inputfield in the script.
Thanks
Ajay
Hi
please check the below example if it helps you
<script language='JavaScript'>
function validateInputField() {
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var inputfield = eval(func("xyzinputfield"));
var inputFieldValue = inputfield.getValue();
input = inputFieldValue.toLowerCase();
if ( input.checkforsomecondition ) {
true perform some action
else { false display some message
alert( "please......... give some message upon failure " ); }
</script>
use some hbj code similar to this
<tr><td width = 40%>
<hbj:inputField
id="xyzinputfield"
type="string"
maxlength="100"
value="Your name here"
jsObjectNeeded="true"
/>
<hbj:button
id="exbutton"
value="Your name here"
OnClientclick="validateInputField()"
/>
regards
jagdesh
Message was edited by: jagdeshwar Manipatruni
Similar Messages
-
Javascript in the htmlb:inputField
Here is the brief description of the problem:
I have a table view in which i display the htmlb:inputField which are created in the iterator. I need to capture the ENTER Key event and set the focus to the next field in the next row.
I have seen examples of the normal input field but couldnn't somehow figure out a way to do it in the htmlb:inputField. Here is the sample code which i tried to play around with (for normal input fields.)..
<i>function enter(nextfield) {
if(window.event && window.event.keyCode == 13) {
nextfield.focus();
return false; }
else
return true; }
</script>
Field 1: <input type="text" name="field1"
onkeypress="return enter(document.demo.field2)"><br>
Field 2: <input type="text" name="field2" onkeypress="return enter(document.demo.field1)"><br></i>
<b>How do i use this code in the iterator for my htmlb:inputField ? i did try the following attributes
1) submitOnEnter
2) onValueHelp
3) doValidate
but none on them could help me..
</b>..
Any help would be appriciated.
Amandeep.Hi Alwyn,
<b>
Works fine when i place it indivisually on the BSP.
I have not been able to figure out a way to do it in the iterator..</b>
<i><%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<script language = "javascript">
function func(nextfield)
if(window.event && window.event.keyCode == 13) {
nextfield.focus();
return false; }
else
return true;
</script>
<htmlb:content design="design2003" >
<htmlb:page title="detail " >
<htmlb:form>
<bsp:findAndReplace find = "<input"
replace = "<input onKeyPress=func(authorfname2);" >
<htmlb:inputField id = "authorfname1"
tooltip = "tooltip1"
value = "<%= authorfname %>" />
</bsp:findAndReplace>
<br>
<bsp:findAndReplace find = "<input"
replace = "<input onKeyPress=func(authorfname3);" >
<htmlb:inputField id = "authorfname2"
tooltip = "tooltip1"
value = "<%= authorfname %>" />
</bsp:findAndReplace>
<br>
<bsp:findAndReplace find = "<input"
replace = "<input onKeyPress=func(authorfname1);" >
<htmlb:inputField id = "authorfname3"
tooltip = "tooltip1"
value = "<%= authorfname %>" />
</bsp:findAndReplace>
</htmlb:form>
</htmlb:page>
</htmlb:content></i>
<b>in the iterator i am trying to do like this</b>
<i> MOVE: p_row_index TO l_rindx,
p_column_index TO l_cindx.
CONCATENATE 'INPUT_' l_cindx '_' l_rindx
INTO l_id.
CONDENSE l_id NO-GAPS.
IF gv_mode = 'P'.
CREATE OBJECT l_input.
l_input->width = '100%'.
l_input->style = 'celldesign:GROUP_LEVEL3'.
l_input->id = l_id.
l_input->cellvalue = 'X'.
l_input->maxlength = 11.
l_input->value = l_string.
p_isreadonly = 'X'.
p_style = 'celldesign:GROUP_LEVEL3'.
start test for the enter key
DATA: l_script TYPE string.
CONCATENATE ' "<input onKeyPress=func(' l_id ')"' INTO l_script.
CREATE OBJECT l_find_repl.
l_find_repl->find = '<input'.
l_find_repl->replace = l_script.
p_replacement_bee = l_find_repl.
end test for the enter key
p_replacement_bee = l_input.</i>
<b>and on the main page i have my same function but doesn't do anything..</b>
<i><script language = "javascript">
function func(nextfield)
if(window.event && window.event.keyCode == 13) {
nextfield.focus();
alert ('hello');
return false; }
else;
return true;
</script></i>
Any suggestions will be appriciated.
Thanks in advance
Amandeep. -
The situation:
I want to use basetext font, but some of the glyphs are missing in it, and are highlighted with pink boxes. common font [stix, etc.] have much more glyphs than basetext font. I can apply common font [stix, etc.]manually for each of the missing glyphs or insert two character and use kerning set it up, but it is tedious.
Question:
How find the missing glyph using javascript [like indesign preflight], and replace same glyph available font or insert two character and use kerning set it up?
Any one know how to do this?
Thanks in Advance,
~JackTry Peter kehrl's script
http://www.kahrel.plus.com/indesign/missing_glyphs.jsx -
HTMLB eventing using javascript
Hello experts,
I have a requirement which i am unable to figure out how to do it .
I have HTMLB dropdown in which the items are popolauted using listitembox. Now my requirement is to disable another drop down depending upon the value selected in this dropdown .
There is no controller in this PDK component . Hence need to use javascript to handle this . But not able to do it.
Could anyone help me in resolving this .
Points will be awared.
Regards,
Pratima.Hi,
never used, but found here: [http://www.sapdesignguild.org/resources/htmlb_guidance/index.html|http://www.sapdesignguild.org/resources/htmlb_guidance/index.html] in this part: [http://www.sapdesignguild.org/resources/htmlb_guidance/dropdown_dev.html|http://www.sapdesignguild.org/resources/htmlb_guidance/dropdown_dev.html] that it should support onClientSelect event - that should do it.
Romano -
How to create new subsite while adding new item to the list by using javascript?
hi,
I hav a task ie, when I add item to the list then subsite will create with that list item title and description . So By using javascript, I have to create subsite while adding new item to the list.
Help me to solve this.
Thank you,Is your item getting added through Javascript client object model ? If yes, you can write in the success delegate of your list creation method the logic to create the subsite.
function CreateListItem()
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('List Name');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', 'My New Item!');
oListItem.set_item('Body', 'Hello World!');
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.CreateListItemOnSuccess), Function.createDelegate(this, this.onQueryFailed));
function CreateListItemOnSuccess() {
var subsiteTitle = oListItem.get_item('Title');
//Logic to create a subsite
function onQueryFailed(sender, args) {
I have added a sample flow for the above scenario. Have a look at the following lnk for how you can craete a subsite using ecmascript.
http://ravisoftltd.wordpress.com/2013/03/06/sharepoint-2010-create-site-with-ecma-script-with/
Geetanjali Arora | My blogs | -
How to find the corrupted files using javascript?
Hi all,
I need to run batch of files some of which were corrupted?? instead of using the method "the files which were not opened are corrupted" is there any way to find the corrupted files??
I need to find this using javascript or apple script??
Please some one help me..
Regards,
subhaWe found one datafile has corrupted by using dbv.dbv would have reported the block ids (block numbers) that are corrupted.
query dba_extents to identify the segments that contain such blocks. -
How to read data from the data provider using javascript
Hi,
Please let me know how to read the data from the dataprovider using javascript(query assigned to the data provider).
My query has filter charateristics, free charateristics, charateristics in rows and key figure in column.
Thanks a lot for your kind help
Regards
KandasamyKandaswamy,
Assign an ID to your table item , then in JavaScript , you can use ID.innerHTML and you will get the HTML code within that table for the same , then you can find out how best to get the exact value you desire from the innerHTML value which is a string with the entire HTML from within the table item.
Arun
Hope it helps.... -
Detecting the JVM version using Javascript in IE
Where can I find the neccessary code to detect the existance and version of the JRE/JVM installed on a client machine. I'm looking for something like this:
http://java.sun.com/j2se/jre_check/index.jsp
I'm not a Java programmer, I don't know how to compile a class file. Can someone help? Thanks.What you reference is a JavaServerPage served from a server. It doesn't use Javascript.
You don't give much information; take a look at these search hits and see if anything listed is what you're after. Some of the threads include Javascript code. (But I'm not very knowledgble of its details.) If not, post back with details, maybe someone then would be able to answer. -
Preselect Htmlb Radiobutton using javascript
Hi Experts,
when I click on a button, i want to preselect a radiobutton using javascript.
I am using below code to get the instance of the radiobutton in the javascript, but I am unable to select the radiobutton.
var theRadio = eval(func(grpId + htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
Thanks in advanceHi,
Try alerting "(theRadio.type)".
If you are getting the proper checkbox instance then the alert should display "checkbox". If that much is working then checking the checkbox is as simple as
var theRadio = eval(func(grpId + htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
if(theRadio)
theRadio.checked = true
By the way what does the function "func" do?
Regards,
Satyajit -
Instance roll back while validating the XML message using Mediator
Hi all,
I am facing issue when calling a mediator process in validating the XML before invoking the target application
Below is the error for the instance.
com.collaxa.cube.engine.EngineException">
Global retry rollback fault thrown.
The current JTA transaction is aborting due to an user rollback fault being thrown. The upstream component should retry in a new JTA transaction upon catching this fault.
This exception was caused by a global retry fault being thrown from downstream component. The user had directed the BPEL engine to roll back the current JTA transaction and retry within new JTA transactions for the specified number of times and retry interval.
There is no action recommended.
-<stack>
<f>
com.collaxa.cube.ws.WSInvocationManager.invoke#334
</f>
<f>
com.collaxa.cube.engine.ext.common.InvokeHandler.__invoke#1070
</f>
<f>
com.collaxa.cube.engine.ext.common.InvokeHandler.handleNormalInvoke#584
</f>
<f>
com.collaxa.cube.engine.ext.common.InvokeHandler.handle#132
</f>
<f>
com.collaxa.cube.engine.ext.bpel.common.wmp.BPELInvokeWMP.__executeStatements#74
</f>
<f>
com.collaxa.cube.engine.ext.bpel.common.wmp.BaseBPELActivityWMP.perform#166
</f>
<f>
com.collaxa.cube.engine.CubeEngine.performActivity#2687
</f>
<f>
com.collaxa.cube.engine.CubeEngine._handleWorkItem#1190
</f>
<f>
com.collaxa.cube.engine.CubeEngine.handleWorkItem#1093
</f>
<f>
com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal#76
</f>
<f>
com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage#218
</f>
<f>
com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory#297
</f>
<f>
com.collaxa.cube.engine.CubeEngine.endRequest#4609
</f>
<f>
com.collaxa.cube.engine.CubeEngine.endRequest#4540
</f>
<f>
com.collaxa.cube.engine.CubeEngine._createAndInvoke#713
</f>
<f>
com.collaxa.cube.engine.CubeEngine.createAndInvoke#560
</f>
<f>
</f>
</stack>
</exception>
-<root class="oracle.fabric.common.FabricInvocationException">
java.lang.NullPointerException
-<stack>
<f>
oracle.tip.mediator.serviceEngine.MediatorServiceEngine.process#1006
</f>
<f>
oracle.tip.mediator.serviceEngine.MediatorServiceEngine.post#663
</f>
<f>
oracle.integration.platform.blocks.mesh.AsynchronousMessageHandler.doPost#142
</f>
<f>
oracle.integration.platform.blocks.mesh.MessageRouter.post#197
</f>
<f>
oracle.integration.platform.blocks.mesh.MeshImpl.post#215
</f>
<f>
sun.reflect.GeneratedMethodAccessor2091.invoke
</f>
<f>
sun.reflect.DelegatingMethodAccessorImpl.invoke#25
</f>
<f>
java.lang.reflect.Method.invoke#597
</f>
<f>
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection#307
</f>
<f>
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint#182
</f>
<f>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed#149
</f>
<f>
oracle.integration.platform.metrics.PhaseEventAspect.invoke#59
</f>
<f>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed#171
</f>
<f>
org.springframework.aop.framework.JdkDynamicAopProxy.invoke#204
</f>
<f>
$Proxy341.post
</f>
<f>
oracle.integration.platform.blocks.local.LocalInvocationProcessor.post#211
</f>
<f>
</f>
</stack>
{code}
I have some knowledge in transaction but this no where in my picture. In bpel process no where i mention transaction is* required* for the mediator component and my mediator is one way asyn process.
Also i defined catch all activity in my bpel and if some thing happen it suppose to move to catch all block but it didn't happen here.
I look forward from some one to help me in resolving in this.
Appreciate some one help here.
Regards,
Tarak.Thanks for the prompt help. Is there any other way instead of removing the DTD line ?. Because the xml is coming as a string and removing the dtd and then adding it will unneccesary hamper performance. Do you any other way in which even though I don't remove the line I get the output without removing the dtd line ?.
thanks and regards,
Sachin -
Validating forms in jsp using javaScript
Hi all i'm trying to validate this form with javeScript. i was testing it with just the <input type=text name= file> first. it works but after the alert message it still posts to writeXML......
i tried putting the fuction valid() after the <form> tag but it still posts it to writeXML.jsp.......can anyone help me please........What i want to do is make sure that something is typed in all the forms befor posting to writeXML..Thanx
<html>
<head> <title>Create MultipleChoice Questions</title> </head>
<script language="JavaScript">
function valid(form) {
if(form.file.value == "")
alert("Please enter the file name")
</script>
<body bgcolor="#cccccc">
<% int count = 0;
String number = request.getParameter("nOfq");
int qNumber = Integer.parseInt(number); %>
<form action="writeXML.jsp" method="POST">
<center>
<table bgcolor="silver" border="1" width="75%">
<tr align="center"><td><b>Type in the Name of your Questionnaire here eg. BlackHistory. Dont leave any spaces between letters</b><br>
<textarea name="file" rows="1" cols="25"></textarea><br>
</td></tr>
<% for(int i=1;i<qNumber+1; i++) { %>
<%count++;%>
<tr align="center" bgcolor="#336699"><td><b>QUESTION <%= count %>: </b><br>
</td></tr>
<tr align="center"><td><b>ENTER QUESTION:</b><br>
<textarea name=<%="questionText"+i%> rows="5" cols="65"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 1:</b><br>
<textarea name=<%="choice_1"+i%> rows="2" cols="50"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 2:</b><br>
<textarea name=<%="choice_2"+i%> rows="2" cols="50"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 3:</b><br>
<textarea name=<%="choice_3"+i%> rows="2" cols="50"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 4:</b><br>
<textarea name=<%="choice_4"+i%> rows="2" cols="50"></textarea><br><br><br>
</td></tr>
<tr align="center" bgcolor="#679995"><td><b>CORRECT ANSWER:</b><br>
<textarea name=<%="cAnswer"+i%> rows="2" cols="50"></textarea><br><br><br>
</td></tr>
<% } %>
<tr>
<td align="center"><input type="submit" name="next" value="NEXTT" onClick="valid(this.form)">
<td align="center"><input type="hidden" name="qCount" value="<%=count+1%>">
</td></tr>
</table>
</center>
</form>
</body>
</html>this Corrected code works perfectly
<html>
<head> <title>Create MultipleChoice Questions</title> </head>
<script language="JavaScript">
function valid(form) {
if(form.file.value == ""){
alert("Please enter the file name");
frmValid.file.focus();
}else{
frmValid.action="writeXML.jsp";
frmValid.submit();
</script>
<body bgcolor="#cccccc">
<% int count = 0;
int qNumber=-1;
String number = clearNull(request.getParameter("nOfq"));
if(! number.equals(""))
qNumber = Integer.parseInt(number);
%>
<form name="frmValid" method="POST" >
<center>
<table bgcolor="silver" border="1" width="75%">
<tr align="center"><td><b>Type in the Name of your Questionnaire here eg. BlackHistory. Dont leave any spaces between letters</b><br>
<textarea name="file" rows="1" cols="25"></textarea><br>
</td></tr>
<% for(int i=1;i<qNumber+1; i++) { %>
<%count++;%>
<tr align="center" bgcolor="#336699"><td><b>QUESTION <%= count %>: </b><br>
</td></tr>
<tr align="center"><td><b>ENTER QUESTION:</b><br>
<textarea name=<%="questionText"+i%> rows="5" cols="65"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 1:</b><br>
<textarea name=<%="choice_1"+i%> rows="2" cols="50"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 2:</b><br>
<textarea name=<%="choice_2"+i%> rows="2" cols="50"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 3:</b><br>
<textarea name=<%="choice_3"+i%> rows="2" cols="50"></textarea><br>
</td></tr>
<tr align="center"><td><b>CHOICE 4:</b><br>
<textarea name=<%="choice_4"+i%> rows="2" cols="50"></textarea><br><br><br>
</td></tr>
<tr align="center" bgcolor="#679995"><td><b>CORRECT ANSWER:</b><br>
<textarea name=<%="cAnswer"+i%> rows="2" cols="50"></textarea><br><br><br>
</td></tr>
<% } %>
<tr>
<td align="center"><input type="submit" name="next" value="NEXTT" onClick="valid(this.form)">
<td align="center"><input type="hidden" name="qCount" value="<%=count+1%>">
</td></tr>
</table>
</center>
</form>
</body>
</html>
<%!
private String clearNull( String sField ) {
return ( sField == null ) ? "" : sField;
%> -
Multiple validation on a form using javascript
Hello.
I have a form w/multiple fields. I want to validate all of these fields when user hit 'submit'. Below is my javascript, what do i have to do/change in order for this script to work in HTML DB? Please advise. Thank you very much.
-Anh
function validation(form) {
var email = form.email.value.toUpperCase();
var email_length = form.email.value.length;
if (form.email.value == "") {
alert("Error!\nAll fields must be entered.");
form.email.focus();
return false;
if (form.cost_center.value == "") {
alert("Error!\nAll fields must be entered.");
form.cost_center.focus();
return false;
if (form.cost_center.value.length < 4) {
alert("Error!\nWrong cost center, cost center has to be at least 4 digits.");
form.cost_center.focus();
return false;
if (form.email.value.length <= 11) {
alert("Error!\nInvalid email format.\nValid example: [email protected]");
form.email.focus();
form.email.select();
return false;
else {
if ((email.substring(email_length -11, email_length)) != "@ORACLE.COM") {
alert("Error!\nInvalid email format.");
form.email.focus();
form.email.select();
return false;
form.cost_center.value = form.cost_center.value.toUpperCase();
return true;Have a look here: http://forums.adobe.com/thread/448695?tstart=0.
I hope it helps.
Ben -
Hi everyone,
I need to write a javascript which will group some object on running the script and then duplcate the same group.After duplicating it will enlarge the same group upto some extend.The object will be generally inside the textframes.We have to group them and then make a duplcate of the group on the same page.Please tell me the javascript code to do the same.
Thanks and regards,
SanatThanks a lot jongware..now its selecting the objects correctly but i m struck with adding the selected objects to the group and duplicating the same group.<br />I tried the follwing code but it didnot work.<br /><br />main();<br /><br />function main(){<br /> if (app.documents.length != 0){<br /> if (app.selection.length > 0){<br /> <br /> var myObjectList = new Array; <br /> var myObjectList = new Array; <br />for (i=0; i<app.selection.length; i++) <br /> myObjectList.push (app.selection[i]); <br /><br />alert ("length of myObjectList is "+myObjectList.length);<br /><br />var myGroup =app.documents.groups.add(myObjectList); <br /><br />var myGroup1=myGroup.duplicate(myObjectList1,myObjectList1);<br /><br /> }<br /> }<br /> }<br /> <br />I know i m asking silly questions but i m a begginer to this scripting and want to learn more.Please guide me with the proper code to do so.<br /><br />Thanks,<br />Sanat
-
How to clear all fields on the page by using javascript ?
Hello,
has anyone an example of javascript function that clears all fields on the page?
ThanksHi Edward,
You may want to have a look here http://textsnippets.com/posts/show/215
Or try this (source from http://www.mindpalette.com/tutorials/clear_defaults/index.php):
function MPClearAll() {
with (document.forms[thisForm]) {
for (var n=0; n<defaultVals.length; n++) {
var thisField = defaultVals[n][0];
var thisDefault = defaultVals[n][1];
if (elements[thisField].value == thisDefault)
elements[thisField].value = '';
}}}Hope that helps,
Dimitri -
How to trigger the "click" event using javascript in LC8?
I have 2 button in the form. I don't want the user to click the button1 directly (invisible now). but I want the user click the button2 and then do some checking. after checking is finisined, the script will continue to trigger the button1 "click" event. How to trigger the button1 "click" event through javascript in LC 8? Thanks.
button2.execevent("click");
Maybe you are looking for
-
Keynote 06 export for "TV Safe" area
I have a title sequence for a DVD that I built in Keynote. It is totally self playing. I used the "Notebook" theme. I am having no problems exporting to a quicktime that I can use in iMovie HD, but I am concerned about most televisions clipping off t
-
PLS-00455: cursor 'CUR_1' cannot be used in dynamic SQL OPEN statement
create or replace function f_my_test_func return refcur_pkg.refcur_t1 is cur_1 refcur_pkg.refcur_t1; begin open cur_1 for 'select * from dept'; return cur_1; exception when others then insert into ddl_log (SQLTEXT) values ('fucntion error'); end;
-
I am looking to implement a point to multipoint wireless bridge network. Security is of high importance and I am looking at ways of providing security to 802.11b. Is IPSec the way forward or should I be looking at 802.1x LEAP as a viable alternative.
-
EASY General Class for structure of ITAB / dynamic ITAB / FCAT
Hi Guys. Seeing all the convoluted posts about Dynamic ITABS, getting the structure of ANY ITAB (whether or not it's in the dictionary) building Dynamic FCATS etc. I'm actually very puzzled as the whole concept is CHILDISHLY SIMPLE. If you model this
-
i'm so confused!! I just want to create interactive pdf files (with video and flash files), but this free trial version is confusing!! help!?!