I'm transferring a value to a field via client side javascript. However, I'm also using server side insertRow(), deleteRow() functions. And, whenever I add a row or delete row, my field value, which got the value from client side returns to initial value, which is empty.
How can I overcome this issue? Do I have to avoid using server side buttons of Ebase?
passing values from client side to server side
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
I've been reading the forum to find some answers. I had AJAX ticked, so I removed it and tested again and saw that page gets refreshed whenever I click a button added from the Palette. So, given that the page gets refreshed all my client side scripts start over, meaning my data gets lost.
How can I prevent page reloads on button click events fired via server side script? Or better yet pass the value to server side before the reload?
How can I prevent page reloads on button click events fired via server side script? Or better yet pass the value to server side before the reload?
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Can you provide some more details of your field and exactly how and when it is populated i.e. which client-side event. I don't think I quite understand your scenario, but here are some suggestions:
1. You need to use Ajax otherwise page refreshes will replace the browser page. If the field in question is an Ebase field then it will be submitted to the server on the (non Ajax) button click and you won't have this problem. If the field is outside of Ebase control, then it will be lost.
2. With Ajax enabled, you might find that moving the Javascript client api call solves the problem. It sounds like your field is being refreshed by the server on each Ajax button click. Try moving the client api call to the ready event of the container control - i.e. the control containing your field.
1. You need to use Ajax otherwise page refreshes will replace the browser page. If the field in question is an Ebase field then it will be submitted to the server on the (non Ajax) button click and you won't have this problem. If the field is outside of Ebase control, then it will be lost.
2. With Ajax enabled, you might find that moving the Javascript client api call solves the problem. It sounds like your field is being refreshed by the server on each Ajax button click. Try moving the client api call to the ready event of the container control - i.e. the control containing your field.
0 x
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
Hi Jon,
I managed to pass my value to server side by using ready event of the container control. I'm using the setFieldValue with autorefresh true. However, now my other values on ebase fields get lost. I think the reason is that when setting refresh to true, all my not validated data gets erased.
I guess the quick solution here would be an immediate validation. But, I don't want to put that on each and every field.
Another idea is to call a server side function from client side which will validate all the fields before autorefresh.
Any other ideas?
I managed to pass my value to server side by using ready event of the container control. I'm using the setFieldValue with autorefresh true. However, now my other values on ebase fields get lost. I think the reason is that when setting refresh to true, all my not validated data gets erased.
I guess the quick solution here would be an immediate validation. But, I don't want to put that on each and every field.
Another idea is to call a server side function from client side which will validate all the fields before autorefresh.
Any other ideas?
0 x
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
Here's the scenario:
AJAX is on.
I'm running Cropit jQuery Plugin to upload images.
I have a profile page with 3 panels.
Panel 1: User details with all the fields mapped to User Database resource.
Panel 2: Profile picture where I run the Cropit function.
Panel 3: Additional details with fields mapped to corresponding DB resource. This one is a table.
Two buttons: Save button(Saves everything) and Add additional details button.(Adds a row)
At first I had this issue:
Whenever I clicked any Ebase button my Cropit image got reloaded and shown as empty, because the input file was null. In order to solve this I added a server side function to send cropped image to an ebase field.
Then, I had the following issue:
Depending on setting the autorefresh to true or false (in setfieldvalue function):
If set to true all my unvalidated fields got nulled and I was seeing empty fields on my browser.
If set to false, I could see the field values but just on client side. On server side they were null. But before, the insert query was sent with all the fields. So, here, I just used fetch to fetch the last entered data and then uploaded the image the way I wanted.
I know it sounds little complicated. I'm just trying to re create a profile page I created using php on wordpress.
And its almost done. Now, I send the cropped image to server side field on every button click but originally it should be only on submit (crop and save).
AJAX is on.
I'm running Cropit jQuery Plugin to upload images.
I have a profile page with 3 panels.
Panel 1: User details with all the fields mapped to User Database resource.
Panel 2: Profile picture where I run the Cropit function.
Panel 3: Additional details with fields mapped to corresponding DB resource. This one is a table.
Two buttons: Save button(Saves everything) and Add additional details button.(Adds a row)
At first I had this issue:
Whenever I clicked any Ebase button my Cropit image got reloaded and shown as empty, because the input file was null. In order to solve this I added a server side function to send cropped image to an ebase field.
Then, I had the following issue:
Depending on setting the autorefresh to true or false (in setfieldvalue function):
If set to true all my unvalidated fields got nulled and I was seeing empty fields on my browser.
If set to false, I could see the field values but just on client side. On server side they were null. But before, the insert query was sent with all the fields. So, here, I just used fetch to fetch the last entered data and then uploaded the image the way I wanted.
I know it sounds little complicated. I'm just trying to re create a profile page I created using php on wordpress.
And its almost done. Now, I send the cropped image to server side field on every button click but originally it should be only on submit (crop and save).
0 x
Who is online
Users browsing this forum: No registered users and 14 guests