Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sorting Using Javascript...

Featured Replies

I don't like using the regular submit buttons... I want to write a Javascript function that will set the value of "-SortField"... but there is a dash ("-") in front of "SortField" that causes an error. Javascript get's it's handles from the "Name" of the "Input" tag.

Is there another way to get around this?

Thanks!

~Addam~

Use the form element numbers, e.g.:

document.myform.elements[5].value = "myfieldname" ;

Alternatively, I believe you can write:

document.myform.elements["-Sortfield"].value = "myfieldname" ;

Hope this helps.

Garry

  • Author

Thanks Garry! I should have known that! lol

Here's another one... The "submit();" fuction... I can't get it to work... My goal here is to create a sortable column via the web. I can pass values to a from, but I get an error saying "Object Doesn't support this property or method".

I just can't stand the look of the regular buttons... Text is better! lol

Try:

document.myform.submit();

Garry

  • Author

that's where I get the error...

This is what I have...

<form action="FMPro" method="post" name="dbsort">

<input type="hidden" name="-DB" value="bammo.fp5">

<input type="hidden" name="-Format" value="thepage.html">

<input type="hidden" name="-Lay" value="testing">

<input type="hidden" name="-SortOrder" value="">

<input type="text" name="-SortField" value="">Last Name

<input type="submit" name="-Find" value="">

Now the submit button in this form does what it's supposed to do.

I'm trying to make this more dynamic by using Javascript to pass values to a function, then that function will set the value of the "-SortOrder" & the "-SortField" and submit the form. According to O'Reilly (great books), the "submit();" function will perform whatever the action of the form. But when I use "document.dbsort.submit();" I get an Error #4, which I think is "Command is unknown"

*pouting* lol

Try this:

<form action="FMPro" method="post" name="dbsort">

<input type="hidden" name="-DB" value="bammo.fp5">

<input type="hidden" name="-Format" value="thepage.html">

<input type="hidden" name="-Lay" value="testing">

<input type="hidden" name="-SortOrder" value="">

<input type="text" name="-SortField" value="">Last Name

<input type="hidden" name="-findall">

<input type="button" value="Sort" onclick="setsortparams()">

</form>

The function "setsortparams()" can use:

"document.dbsort.submit()"

Hope this helps.

Garry

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.