cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing HTMLB elements in JavaScript

Former Member
0 Kudos

Hi,

I have the one requirement ie. Validating user input on click of a button in my BSP application. Canone guide me how this can be done.

Appriciate if anyone can provide a Sample code for this.

In another forum I found a thread on the same topic, but couldn't understand completely.

</thread/19386 [original link is broken]

I am trying to follow the same approach mentioned below, given in the earlier thread.

-


function myValidateFields(){

var ib, func, funcName;

funcName = htmlb_formid+"_getHtmlbElementId";

func = window[funcName];

ib = eval(func("InputSAPNumberResults"));

if (ib.getValue() < 1 || ib.getValue() > 250 ){

alert("field value out of range");

}

}

-


I am not well versed with Java Script. Just started exploring this.

"htmlb_formid", Can anyone tell what this represents in above solution. Browser is showing an error message "htmlb_formid" is undefined. I have copied the code as is in my BSP application. What I understand is either "htmlb_formid" has to be defined earlier or It should be replaced with my BSP application specific layout components(not sure).

Hints please...

Thanks,

Pramod

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

U can write the javascript function in the header tag or create a .js file in which u write the javascript code.

the javascript code can be like

function ValidateForm()

{

if(document.form1.s_material.value=="")

{

alert("enter material");

return false;

}

return true;

where form1 is id of form and s_material is iD of input field.

In your coding for button onClientClick like :

<htmlb:button id="s_but_submit"

width="20"

onClick="submit"

onClientClick="if(!ValidateForm(this))htmlbevent.cancelSubmit=true;"

Regards,

Siddhartha

Answers (1)

Answers (1)

athavanraja
Active Contributor
0 Kudos

I think the one you are referring to is portal htmlb:tags.

for the BSP specific stuff, siddarth has given a good example.

The best way to identify how the names are rendered for htmlb tags, check out the source the rendered BSP page.

Regards

Raja